• Resolved Huw Tyler

    (@huwtyler)


    As far as I know, this isn’t a standard bit of coding and I’ve tried hacking a couple of the functions and amending existing plugins to achieve this. I know it’s possible to generate a list of posts on a page using wp_get_archives or a category plugin but…

    I am attempting to generate a list (similar to wp_get_archives) that outputs the post thumbnail. When wp_get_archives generates its list, it outputs it as an LI list, but only outputs the linked title.

    Any clues on generating each post’s thumbnail as part of this data?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Huw Tyler

    (@huwtyler)

    Thanks for that esmi. I’ve had a look through that and tried to implement it into the site I’m working on.

    It works for posts but won’t work for the times when I want to mix Posts onto a Page.

    I’m using query_posts or the standard loop to call a list of posts, then have a secondary loop to call the page (which is a PAGE rather than a number of posts). It works for listing posts but not pages.

    I’ve also tried to rewind_posts(). Again this works for posts but won’t call a page.

    Is there something that I can call the page I want that doesn’t affect the loop?

    Help!!

    Thread Starter Huw Tyler

    (@huwtyler)

    Got it! This is a neat trick for listing posts on a page above ordinary content:

    <?php $args = array(
    				'posts_per_page' => 4,
    				'post_type' => 'post',
    			);
    
    			query_posts($args);
    
        if (have_posts()) : ?>
    
          <?php while (have_posts()) : the_post(); ?>
          	[POST PROPERTIES IN HERE]
    
           <?php endwhile; ?>
           <?php endif; ?>

    Then make sure you <?php wp_reset_query(); ?>

    Then you can have a normal loop below that.

    If someone spots that this is bad practice or will cause trouble in the future, please say but for now, enjoy posting posts on pages!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Generating Post Thumbnails as a list on Pages’ is closed to new replies.