• Hello,
    i have the code below and i need to customize so hen a user clicks on category A he sees all and just the posts from that category , if they click on category b they see posts just from that category….i want to set it to show just 3 posts as well with a pagination option ….i have the pagination done its just the showing specific category posts that is an issue…any help from the wp community 🙂

    <?php
    get_header();?>
    
    <!-- MAIN -->
    <div id="main">
    
    <!-- Content area -->
    <div class="content">
    
        <!-- LeftPart -->
        <div id="leftPart">
    
            <?php
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            query_posts("showposts=5&paged=".$paged);
            while(have_posts()):the_post();
            ?>
    
            <?php in_category( $category, $_post ) ?>
            <!-- Blog Entry -->
            <div class="blog_entry">
                <!-- Inside -->
                <div class="inside">
    
                    <div class="date"><?php the_time('F l, Y'); ?> at <?php the_time('g:i a'); ?> </div>
                    <div class="comments"><?php echo get_comments_number();?></div>
                    <br class="clear" />
    
                    <h3><a href="<?php the_permalink();?>"><?php the_title();?></a></h3>
    
                    <?php
                    $attr = array('class'	=> "one_col_shadow_img");
                	the_post_thumbnail('blogs',$attr);?>
                    <p class="biglines"><?php echo get_the_excerpt();?></p>
    
                    <a href="<?php the_permalink();?>" class="arrow_read"><span class="inv">Read more</span></a>
    
                <br class="clear" />
                </div>
                <!-- /Inside -->
            </div>
            <!-- /Blog Entry -->
    
            <?php endwhile; paginator(); ?>
    
            <br class="clear" />
    
        </div>
        <!-- /LeftPart -->
    
        <!-- Sidebar -->
        <div id="sidebar">
            <!-- Inside -->
            <div class="inside">
    
            <?php get_sidebar();?>
    
            </div>
            <!-- /Inside -->
        </div>
        <!-- /Sidebar -->
    
        <br class="clear" />
    
    </div>
    <!-- /Content area -->
    
    <!-- Main bottom [ DO NOT REMOVED ] -->
    <div id="main_bottom" class="main_bottom_<?php echo get_option('zombie_designtype',true);?>">
        <div class="content"></div>
    </div>
    <!-- /Main bottom -->
    </div>
    <!-- /MAIN -->
    <?php get_footer();?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Alwyn Botha

    (@123milliseconds)

    Thread Starter nyckidd

    (@nyckidd)

    thanks…but i dont know where to place the code in the above code i posted…Help 🙂

    Alwyn Botha

    (@123milliseconds)

    around line 10 replace with

    query_posts(“cat=1,2,3&showposts=5&paged=”.$paged);

    Replace 1,2,3 with required categories or just ONE number

    Thread Starter nyckidd

    (@nyckidd)

    hey, thanks…when i have it this way it works

    <?php
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            query_posts("cat=13&showposts=5&paged=".$paged);
            while(have_posts()):the_post();
            ?>

    but when i have it this way

    <?php
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            query_posts("cat=13,53&showposts=5&paged=".$paged);
            while(have_posts()):the_post();
            ?>

    it pulls all the posts from both categories…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show only posts from specific category wih pagination’ is closed to new replies.