Functions previous_post_link() and next_post_link() do not work
-
I’m trying to load a post navigation function above my post title and after my post comments in Genesis. Here is the function that I’m running:
/** Load previous/next post link before title */ function genesis_post_navigation() { if ( is_single ( ) ) { echo '<div class="prev-next-posts"><div class="prev-post-link">'; previous_post_link('<strong>%link</strong>'); echo '</div><div class="next-post-link">'; next_post_link('<strong>%link</strong>'); echo '</div></div>'; } } add_action( 'genesis_before_post_title', 'genesis_post_navigation'); add_action('genesis_after_comments', 'genesis_post_navigation');
Everything works as it should aside from the links generated by the WP functions: previous_post_link() and next_post_link(). The only post previous links to is ‘Hello World’ i.e. the oldest post on the blog and the only post next links to is the second-oldest. Most of the time, the links don’t actually display anything at all.
You can see the site in action here.
What is going on here and why doesn’t it work properly?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Functions previous_post_link() and next_post_link() do not work’ is closed to new replies.