Support » Themes and Templates » [Resolved] Display 1 recent post from each category

[Resolved] Display 1 recent post from each category

  • How do I control the number of posts display on the blog page but I only want 1 post visible on each category page?

    In relation to the last question: How can I display 1 post from each category on the blog page. I only want each recent post to be displayed.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Here is the plugin for your requirement…..


    Let me know how you like this and if any suggestion….


    Thank you so much.
    I have built a page template with the proper code to achieve this functionality, but I definitely saved your plugin.

    Let me know if you’re interested in my page template.

    Hi jknetdesign,

    Would you mind sharing your page template? I’m looking into same solution of displaying all my categories at the homepage… It would save me a lot of time creating the template from scratch:)


    Hi, Have you tried this plugin ?


    If you have any issue/suggestion in using this plugin, please let me know, I would be more than happy to help you on this.

    Sure ill send it when I return.

     * Template Name: First Post Category
     * This template display the first post from each selected category.
    get_header(); ?>
        <div id="primary" class="site-content">
            <div id="content" role="main">
    <!-- Latest from Each Category (add your own use commas to separate) -->
    <?php query_posts(
                array('category_name'=>"IconoCraft, Poetry, Opinion, Karma, Zen Shin Progress",
          ); ?>
        <?php if (have_posts()) : ?>
        <?php while (have_posts()) : the_post(); ?>
        <!-- Entry Title -->
        <div class='cat-entry'>
            <header class="entry-header">
                <?php if ( is_single() ) : ?>
                <h1 class="entry-title"><?php the_title(); ?></h1>
                <?php else : ?>
      	$cats = wp_get_post_categories($post->ID);
    	$cat_name = 'Unknown';
    	if($cat = array_shift($cats)) {
    		$cat = get_category($cat);
    		$cat_name = $cat->name;
                <h2 class="archive-title"><?php printf( __( 'Featured Post: %s', 'twentytwelve' ), '<span>' . $cat_name . '</span>' ); ?></h2>
                <div class='cat-entry-thumb'><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_post_thumbnail('excerpt-thumbnail', 'class=alignleft'); ?></a></div>
                <h1 class="entry-title">
    				<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
                <?php endif; // is_single() ?>
            </header><!-- .entry-header -->
        <!-- Entry Content -->
            <div class="entry-content">
                <?php the_excerpt( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?>
                <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
            </div><!-- .entry-content -->
             <?php if ( comments_open() ) : ?>
                    <div class="comments-link">
                        <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
                    </div><!-- .comments-link -->
                <?php endif; // comments_open() ?>
            <?php endwhile; ?>
        <?php endif; ?>
        <!-- End of Category Display -->
            </div><!-- #content -->
        </div><!-- #primary -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thanks for sharing, I’ll be playing with it once I’m done adding some content:)

    @mindstien Technologies
    Your plugin is a good one but I’m a little concerned about the styling. One question though, is the boxed layout default?

    yes, boxed layout is default, however, I would like your suggestion to improve the plugin for you and other users…

    CanI see an example of the plugin in action?

    My site is not live yet, I’m still in a development phase under WAMP. I’ll provide the link maybe in a week or two.. Thanks!


    The exmample in action at fungujarati.com, its in gujarati language but you can see the look on homepage (boxed layout).


    Hi, I really like your plugin Mindstein.
    I appears to be repeating on my page. Can you help? I only want 1 post from 1 category to show.

    Hey @georgeeadie

    Thanks for using the plugin, you might be using both shortcode and auto insert facility , check the plugin settings for it…


Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Display 1 recent post from each category’ is closed to new replies.