axiomjunglist
Member
Posted 5 years ago #
Ok, I'm desperate. I've been scouring the net for a few days looking for the right information and I don't know if I'm on the right track. I feel like I'm going in circles. It seems simple enough though...
This is the site layout. I'm working on a theme that will fit it accordingly:
http://web.pdx.edu/~dgaumont/other/motif.jpg
What I want to do is have the sidebar display the top container with the top three post titles from a specified post category along with their corresponding post date, and the bottom container with the post title and first line of the post from a specified catagory.
The closest thing I've found that might do something like this was here:
http://codex.wordpress.org/Template_Tags/query_posts
Am I on the right track? Please help! :(
Define "top three posts" and somebody might be able to help you.
axiomjunglist
Member
Posted 5 years ago #
Maybe I should rephrase as the 'latest' three posts. So if I have a blog page with multiple categories, I want to be able to tell the container to grab the latest three posts from a specified category.
Does that make sense?
Thanks for the help!
axiomjunglist
Member
Posted 5 years ago #
Ok I think I found the answer to my own problem, however now I have a new question. Here's the code I found and modified:
<h2>Events</h2>
<?php query_posts('cat=4&showposts=3'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php if ( in_category(4) ) { ?>
< 'a' href="<?php">><?php the_title(); ?> - <?php the_date(); ?>
<?php } else {
}; ?>
<?php endwhile; ?>
(Note: The 'a' href is shown that way because the code breaks when I post it here)
That's great except that info shows up on every page in the
sidebar. I'd like to add a conditional statement that runs the code above in the sidebar only if on a specified page, i.e.
<?php if ( is_page('8') ) { ?>
then,
the above code would work...
is that possible?
webgirl
Member
Posted 4 years ago #
Looking for a top post code or plugin also which can display only by the categories that you select and the number of posts you choose ... not the entire list of categories. Anybody came across anything?