Moderator
t-p
(@t-p)
Try:
<?php $recentpost = new WP_Query("showposts=1&&category__in=xx");
where xx = your chosen category id.
Try:
<?php $recentpost = new WP_Query(“showposts=1&&category__in=xx”);
where xx = your chosen category id.
I couldn’t get that piece of code to work, maybe I should have posted the entire snip-it of code I’m using on my page.php file
here is my entire snip-it:
<div id="content-inner">
<h1 class="post-title">Featured Mountain Hardware Website</h1>
<div> </div>
<?php $recentpost = new WP_Query("showposts=1"); while($recentpost->have_posts()) : $recentpost->the_post(); ?>
<h1><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h1>
<div> </div>
<?php the_content(); ?>
<?php endwhile; ?>
</div>
Moderator
t-p
(@t-p)
try this:
<?php
//display 5 post from category 77
$args=array(
'showposts'=>5,
'category__in' => array(77),
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
the_content(); //use the_excerpt() for a summary
?>
<?php
//this is necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
endwhile;
}
?>
Moderator
t-p
(@t-p)
Glad you got it working. 🙂
Please mark this thread “resolved” using the dropdown in the right panel.