Displaying latest 2 blog posts in a two-column layout horizontally

  • Unknown's avatar

    I’m wondering how to code the css and php to show my latest two post’s titles and their featured images in a two column setup horizontally. This is what I have currently, but it shows the same image for each post. Wondering how to specify the featured image to match the post. Thanks!

    Latest Posts

    Read the latest posts from A History of Heroes!

      <?php
      if (has_post_thumbnail() ){
      echo '

      ‘;
      the_post_thumbnail();
      echo ‘

      ‘;
      }
      ?>

      <a href='’ rel=’bookmark’ title=’Permanent Link to ‘>

      <?php
      if (has_post_thumbnail() ){
      echo '

      ‘;
      the_post_thumbnail();
      echo ‘

      ‘;
      }
      ?>

      <a href='’ rel=’bookmark’ title=’Permanent Link to ‘>

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Fixed it! I was using unnecessarily complex code, just had to throw the_post_thumbnail in the loop for each column.

  • The topic ‘Displaying latest 2 blog posts in a two-column layout horizontally’ is closed to new replies.