Sam Designs
Jan 27th 2008, 8:51 am
<?php
$my_query = new WP_Query('category_name=featured&showposts=1');
if (have_posts()) : while (have_posts()) : the_post();
update_post_caches($posts);
$name = the_title('','',false);
$name = ShortenText($name);
?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo $name; ?></a></li>
<?php endwhile; endif; ?>
I use that script to grab all the post titles and links in the featured category, then put them in a list. It works fine on index.php - but when it's on any other page - it just grabs all the pages from the current category, or the current page etc.
Anyway to make it so it works on every page?
Thank you,
Sam.
$my_query = new WP_Query('category_name=featured&showposts=1');
if (have_posts()) : while (have_posts()) : the_post();
update_post_caches($posts);
$name = the_title('','',false);
$name = ShortenText($name);
?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo $name; ?></a></li>
<?php endwhile; endif; ?>
I use that script to grab all the post titles and links in the featured category, then put them in a list. It works fine on index.php - but when it's on any other page - it just grabs all the pages from the current category, or the current page etc.
Anyway to make it so it works on every page?
Thank you,
Sam.