因此,在多次尝试纠正这一点之后,页面似乎没有加载,但没有从每个类别中提取正确的帖子。每当我点击每个类别链接时,它似乎都会吸引相同的默认帖子。
我试图自定义查询,但运气不好,下面是我正在使用的代码。
<?php global $up_options, $post, $paged, $wp_query; ?>
<?php get_header(); ?>
<div id="bodywrapper">
<?php $args = array(
\'title_li\' => __( \'\' ),
); ?>
<div class="category-list"><?php wp_list_categories($args); ?></div>
<div style="height: 25px"></div>
<div id="content">
<h1>Case Studies</h1>
<?php
/* retrieves all the terms from the taxonomy portfolio */
$args = array(
\'type\' => \'post\',
\'orderby\' => \'name\',
\'order\' => \'ASC\',
\'taxonomy\' => \'category\');
$categories = get_categories( $args );
/* pulls 5 posts from each of the individual categories */
foreach( $categories as $catergory ) {
$args = array(
\'posts_per_page\' => 5,
\'post_type\' => \'post\',
\'category\' => $category->slug,
\'no_found_rows\' => true,
\'update_post_meta_cache\' => false,
\'update_post_term_cache\' => false
);
}
$the_query = new WP_Query ( $args );
// the loop
while ( $the_query->have_posts()) : $the_query->the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="post">
<a href="<?php the_permalink() ?>">
<?php if (has_post_thumbnail()) { ?>
<?php the_post_thumbnail(\'thumbnail\'); ?>
<?php }?>
</a>
<h1 class="post-title"><a href="<?php echo get_post_meta($post->ID, \'lj_file_url\', true) ?>" title="<?php the_title(); ?>"> <?php the_title(); ?></a></h1>
<div class="post-entry">
<a href="<?php echo get_post_meta($post->ID, \'lj_file_url\', true) ?>" title="Download pdf <?php the_title(); ?>"> <img src="http://www.integra-av.co.uk/wp-content/uploads/2012/04/pdflogo.png" alt="" class="alignleft"/></a>
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile;
?>
<?php // Reset Post Data
wp_reset_postdata(); ?>
<div class="clear">
<?php wpld_pagenavi(); ?>
</div>
<br/><br/><br/><br/><br/><br/>
<p style="text-align: center;"><span style="font-size: 35px;"><span style="color: #2788e4;">Secure Solutions</span></span></p>
</div>
<?php get_footer(); ?>
这里有一个指向我正在处理的当前页面的链接here