WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display featured Posts on Page and adhere to 'the more' (4 posts)

  1. jcrich53
    Member
    Posted 5 years ago #

    I am trying to figure out how to have a series of featured posts that would appear on a static page on my WP blog.

    I have found a number of plugins that will enable me to list the post title of posts from a particular category (e.g. Catlist plugins). However, what I want is the capacity to include the intro paragraph (everything before the "read more" break) to be included.

    Any suggestions on doing this?

    Thank you.

  2. MichaelH
    Member
    Posted 5 years ago #

    Try this:

    <?php
       $args=array(
       'cat'=>1,
       'showposts'=>10,
       'caller_get_posts'=>1
       );
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <p><small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
    
    <?php
    global $more;
    $more=0;
    the_content('Read the rest of this entry &raquo;');
    <?php
    endwhile;
    }
  3. jcrich53
    Member
    Posted 5 years ago #

    Thanks.

    Where should I place this? (What file?)

  4. MichaelH
    Member
    Posted 5 years ago #

    It could be your theme's index.php or it could be a Page Template.

    With the help of the Template Hierarchy article, determine what Template is 'in force' where you want to display that featured post info.

    Also, if you use the technique described in the FAQ, How can I have a static front page and posts display on a page called Blog? , you would put that code in the myfront.php template described in that FAQ.

Topic Closed

This topic has been closed to new replies.

About this Topic