[Solved] tumblelog/wordpress question
# March 11, 2010 at 4:16 pm
i’m working on a blog that shows one post per page – using this code on my index pageCode:< ?php query_posts('posts_per_page=1'); ?>
< ?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>id=”post-< ?php the_ID(); ?>“>
< ?php the_content(); ?>
< ?php endwhile; else: ?>
Sorry, no posts matched your criteria.
< ?php endif; ?>
what i’m trying to to is implement something like this:
so i can show tumblelog style posts in my footer.
i have the code working just fine. it shows the tumblelog style posts in the footer, but what i’m trying to do is keep my main posts separate from my tumblelog style posts. as it stands, when i hit previous – and go to my single.php, it takes me to whatever the previous post is – whether or not it’s a tumblelog or main post catagory.
my next previous links on my main header areCode:
< ?php query_posts('posts_per_page=1&offset=1'); the_post(); ?>
- ” rel=”prev”>previous
< ?php wp_reset_query(); ?>
and header single the are:Code:
- < ?php previous_post_link('%link','previous') ?>
- < ?php next_post_link('%link','Next') ?>
what i mean is, i only want the main posts to show up on single php and i want my tumblelog style posts to remain in the footer.
does that make sense? i really appreciate any help that can be provided.
DSD.# March 11, 2010 at 4:59 pm
You can use the $in_same_cat parameter to restrict navigation to the category of the current post. Alternatively you can set $excluded_categories to the categories you want to exclude. (It’s a bit of a strange syntax, you use $excluded_categories = "1 and 7 and 8 and 31" ).Code:< ?php previous_post_link($format, $link, $in_same_cat = false, $excluded_categories = ''); ?>
You must be logged in to reply to this topic.