Displaying different posts Via wp_list_categories()


I believe this problem to be quite simple but can’t seem to get my head around how to solve it.

So I’m pulling in all the category with posts in using wp_list_categories();

My problem is when I click through it pulls in the correct posts but, I want it to pull in the correct posts and still have wp_list_categories links at the top so someone can switch between the posts.

So really all that needs to change is that when you click a category link the relevant posts get pulled looking the same as there displayed now.

I know this is going to involve conditions and maybe some new queries written – I want to try and do this in the most robust way possible.

Link to the page

code at the moment generating this page.

 *  * Template Name: Case Studies
<?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>

    $start = $wp_query;
    $wp_query = null;
    $wp_query = new WP_Query();
        while ($wp_query->have_posts()) : $wp_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 }?>
                        <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(); ?>
                <?php endwhile; ?>
                <div class="clear">
                    <?php wpld_pagenavi(); ?>


<p style="text-align: center;"><span style="font-size: 35px;"><span style="color: #2788e4;">Secure Solutions</span></span></p>
    <?php get_footer(); ?>
, dannyw24 9 years 2013-10-15T11:14:39-05:00 0 Answers 65 views 0

Leave an answer