Styling Previous/Next Pages differently from Index
Your theme’s body_class can be used to target specific pages: body.home /* front and subsequent pages */ body.paged /* any page *except* front page */
Your theme’s body_class can be used to target specific pages: body.home /* front and subsequent pages */ body.paged /* any page *except* front page */
Try this, nice and simple: <?php next_post(‘%’, ‘Prev: ‘, ‘yes’); ?> <?php previous_post(‘%’, ‘Next: ‘, ‘yes’); ?>
thank u all i just did a simple code to get what i want <?php $prevyear = date(‘2150’) – 0001; $nextyear = date(‘2150′) + 0001; $prevmonth = date(’01’) – 01; $nextmonth = date(’01’) + 01; echo echo get_year_link($prevyear).”<br />”.get_year_link($nextyear).”<br />”.get_year_link($prevmonth).”<br />”.get_year_link($nextmonth).”<br />”; ?>
get_adjacent_post() returning weird results
Next Previous siblings child pages
get_previous_post uses get_adjacent_post() which has a bunch of filter hooks you can use but a much simpler approach would be to create your own function, something like this: // Create a new filtering function that will add our where clause to the query function date_filter_where( $where=”” ) { global $post; $where .= ” AND post_date … Read more
Use get_adjacent_post to first see if there’s actually a next post: if (get_adjacent_post (false, ”, false)) { next_post_link (‘%link’, ‘Next Project >’, true, ”, ‘projectcategory’); } else { // manually create link to first post here } This site shows one way of actually getting the first post’s link, such as with a WP_Query call … Read more
Depending on context, you may need global $post; first, so you’re not operating on a different local var. You also already have a post object, so you could just assign that directly to $post before calling setup_postdata… However, you can skip all that and use functions that accept a post object argument- $prevPost = get_previous_post(true); … Read more
I had the exact same problem a while ago on one of my themes. My problem was that the theme used query_post to filter out some posts. This caused the pagination to fail. I think this was the code that solved it: <?php if ( is_home() ) { $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; … Read more
I’d say go with categories: it seems your categories are already being used for ‘back-end’ purposes, so I’d imagine they’re already hidden from the front-end users. Otherwise, go for a custom taxonomy (something like ‘issue’ taxonomy perhaps), which is a bit more work, but gives you a lot more control. Take a look at the … Read more