• Resolved do77

    (@do77)


    Hey everyone,

    I am featuring some posts from a specific category on the homepage. The problem is that the sections always displays the most recent posts but I want to choose which posts I want to display by ID. Unfortunately I dont know how to change the code so that the sections would only display the post ID’s I put in there.

    Here is the code:

    <?php $recent = new WP_Query("cat=166&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>
    
    				<?php if( get_post_meta($post->ID, "thumbnail", true) ): ?>
    				    <a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;" src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="<?php the_title(); ?>" /></a>
    				<?php else: ?>
    				   	<a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;"  src="<?php bloginfo('template_url'); ?>/images/thumbnail.png" alt="<?php the_title(); ?>" /></a>
    				<?php endif; ?>
    				<b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b>
    				<?php the_content_limit(80, ""); ?>

    Can someone help me with that. I have been trying it multiple times but I always get error messages. I want to feature a total of 3 posts.

    Thank you so much,
    Dom

Viewing 1 replies (of 1 total)
  • Thread Starter do77

    (@do77)

    I replaced

    while($recent->have_posts())

    with an array and included specifc post ID’s.

    In case someone had the same problem!

Viewing 1 replies (of 1 total)
  • The topic ‘Display specific posts, NOT most recent!’ is closed to new replies.