Thanks for your reply. That run but not all:
– That display one post only (but I have two with this metakey) maybe I need to put “showposts number” elsewhere
– The read more link reload the page itself and doesn’t point to permalink of the post
You then have to setup $myposts and loop through the results
I think the answer is here but don’t know exactly how to deal with. My first code:
<h4>Actualité Alter Ego</h4>
<?php $actus = new WP_Query("cat=4&showposts=4"); while($actus->have_posts()) : $actus->the_post();?>
<img class="thumb" src="<?php bloginfo('template_url'); ?>/img/thumbs/<?php echo get_post_meta($post->ID, "Thumb", true); ?>" alt="<?php the_title(); ?>" width="60" height="40" />
<h5><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h5>
<?php the_content_limit(75, "Lire la suite »"); ?>
</div><div class="filethred"></div>
<?php endwhile; ?>
<div class="colrightbot"></div>
</div><!-- END content colright-->
<div class="post"><!-- START content post-->
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="entry"><?php the_content(); ?></div>
<?php endwhile; ?>
And now with your changes:
<h4>Actualité de Alter Ego</h4>
<?php $querystring = "
SELECT wposts.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = 'Esat'
AND wpostmeta.meta_value = 'Hennebont'
AND wposts.post_status = 'publish'
AND wposts.post_type = 'post'
ORDER BY wposts.post_date DESC
";
$myposts = $wpdb->get_results($querystring, OBJECT);?>
<div class="actus">
<img class="thumb" src="<?php bloginfo('template_url'); ?>/img/thumbs/<?php echo get_post_meta($post->ID, "Thumb", true); ?>" alt="vignette" width="60" height="40" />
<h5><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h5>
<?php the_content_limit(75, "Lire la suite »"); ?>
</div><div class="filethred"></div>
<div class="colrightbot"></div>
</div><!-- END content colright-->
<div class="post"><!-- START content post-->
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="entry"><?php the_content(); ?></div>
<?php endwhile; ?>
I want to display the thumb and content_limit of the post and also show 4 posts in that cat. I trying different code with always error ??