The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Placing Recent Posts on Responsive Theme Stock Homepage

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #169152

    Hey guys! I’m using THE responsive theme for my site. It’s great, but I’m trying to do something and confused slightly on how to do it.

    I want my most recent posts on the homepage. I’ve actually done it…but not in the way I’d have liked. So I deleted it and decided to ask on here.

    The file “front-page.php” has this code in it:

        get_sidebar( 'home' );

    This code is both calling the 3 widgets on the homepage (that will eventually link to their respective galleries), and also the footer. However I’d like to insert code between the widgets and the footer that calls on my 3 most recent posts in the exact way they look like on my blog page. Featured images and all (minus the sidebar of course). Can I do this? If so, can some kind soul help me complete this lol?


    Ok so I’ve copied this piece of code from the index.php file and place it between the pieces of code up above:

        &lt;?php if( have_posts() ) : ?&gt;
        &lt;?php while( have_posts() ) : the_post(); ?&gt;
            &lt;?php responsive_entry_before(); ?&gt;
            <div>" &lt;?php post_class(); ?&gt;&gt;
                &lt;?php responsive_entry_top(); ?&gt;
                &lt;?php get_template_part( 'post-meta-page' ); ?&gt;
                    &lt;?php if( has_post_thumbnail() ) : ?&gt;
                        <a>" title="&lt;?php the_title_attribute(); ?&gt;"&gt;
                            &lt;?php the_post_thumbnail(); ?&gt;
                    &lt;?php endif; ?&gt;
                    &lt;?php the_excerpt( __( 'Read more ›', 'responsive' ) ); ?&gt;
                &lt;?php get_template_part( 'post-data' ); ?&gt;
                &lt;?php responsive_entry_bottom(); ?&gt;
            </div>&lt;!-- end of #post-&lt;?php the_ID(); ?&gt; --&gt;
            &lt;?php responsive_entry_after(); ?&gt;
        get_template_part( 'loop-nav' );
        else :
        get_template_part( 'loop-no-posts' );

    Now how can I get this to just display the current 3 posts???


    Ok so managed to cut the code down even more, but still having trouble only displaying the recent 3 posts that have a featured image. The updated code:

     <?php while( have_posts() ) : the_post(); ?>
            <?php responsive_entry_before(); ?>
            <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                <?php responsive_entry_top(); ?>
                <?php get_template_part( 'post-meta-page' ); ?>
                <div class="post-entry">
                    <?php if( has_post_thumbnail() ) : ?>
                        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                            <?php the_post_thumbnail(); ?>
                    <?php endif; ?>
                <?php get_template_part( 'post-data' ); ?>
                <?php responsive_entry_bottom(); ?>
            </div><!-- end of #post-<?php the_ID(); ?> -->
            <?php responsive_entry_after(); ?>

    Ok so I redid everything, and now this is the code that I’m using:

    `&lt;h4&gt;Recent Posts:&lt;/h4&gt;
    &lt;?php query_posts('posts_per_page=3'); ?&gt;
    &lt;?php while (have_posts()) : the_post(); ?&gt;
        &lt;li style="list-style:none;"&gt;
        &lt;h4&gt;&lt;?php the_title(); ?&gt;&lt;/h4&gt;
        &lt;?php the_date(); ?&gt;
        &lt;a href="&lt;?php echo get_permalink(); ?&gt;"&gt;
                     &lt;?php the_post_thumbnail('large_wide'); ?&gt;
    &lt;?php endwhile; ?&gt;
    &lt;?php wp_reset_query(); ?&gt;`

    Seems to work pretty good.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.