0
在我的主题中,我有一个博客页面和一个主页(没有博客循环)。现在我想在我的主页上添加一些博客帖子(如最新版)。在同一站点(WP)的两种不同情况下使用外部循环
我正在使用博客页面作为主页模板(我复制并重命名原件),这很好。但是,如果不更改原始博客页面(该循环在外部php中调用),我无法进行任何更改。
我不知道要开始。
这是在首页调用博客圈片:
<?php if(have_posts()) : the_post(); ?>
<div id="main">
<div class="central-wrapper clearfix">
<div id="center" class="fullwidth">
<div id="content">
<?php if($gallery_select && $gallery_position == 1) : ?>
<?php codeus_gallery($gallery_select, $gallery_size, $gallery_style); ?>
<?php endif; ?>
<div class="inner">
<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<div class="pagination"><div class="page-links-title">' . __('Pages:', 'codeus') . '</div>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); ?>
<div class="bloghome">
<?php codeus_blog_list(); ?>
</div>
<?php if($quickfinder_position == 2) : ?>
<?php codeus_quickfinder($quickfinder_select); ?>
<?php endif; ?>
<?php if($portfolio_position == 2) : ?>
<?php codeus_portfolio(implode(',',$portfolio_select), $portfolio_size, $portfolio_count, $portfolio_filter, $portfolio_title); ?>
<?php endif; ?>
<?php if($gallery_select && $gallery_position == 3) : ?>
<?php codeus_gallery($gallery_select, $gallery_size, $gallery_style); ?>
<?php endif; ?>
</div>
</div><!-- #content -->
</div><!-- #center -->
</div><!-- .central-wrapper -->
</div><!-- #main -->
<?php endif; ?>
</div><!-- wrap end -->
这是一块在外部PHP称为blog.php的
<?php if($blog_loop->have_posts()) : ?>
<div class="blog_list">
<ul class="styled">
<?php while ($blog_loop->have_posts()) : $blog_loop->the_post(); ?>
<li class="clearfix">
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php $image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'codeus_post_list_image'); ?>
<div class="comment-info">
<a href="<?php echo get_permalink($post->ID); ?>" class="date-day"><?php echo get_the_date('d'); ?></a>
<div class="date-month"><?php echo get_the_date('M'); ?></div>
</div>
<div class="post-info">
<h3><a href="<?php echo get_permalink($post->ID); ?>"><?php the_title(); ?></a></h3>
<?php if($image_url[0]) : ?>
<div class="post-image">
<div class="image wrap-box shadow middle">
<div class="shadow-left"></div><div class="shadow-right"> </div>
<a href="<?php echo get_permalink($post->ID); ?>"><img src=" <?php echo $image_url[0]; ?>" alt="<?php the_title(); ?>" /></a>
</div>
</div>
<?php endif; ?>
<div class="text clearfix"><?php the_excerpt(); ?></div>
<?php codeus_author_info(get_the_ID()); ?>
</div>
</div>
</li>
<?php $post = $portfolio_posttemp; wp_reset_postdata(); ?>
<?php endwhile; ?>
</ul>
<?php codeus_pagination($page_num, $pages_count); ?>
</div>
<?php endif; ?>
记住,我不想在原来的blog.php中进行更改,因为正常的博客页面需要像现在这样工作。我想在主页上做博客工作,但最多只能显示3个帖子,可能是某个类别。
帮助将是如此的欢迎!