Support » Fixing WordPress » Functions previous_post_link() and next_post_link() do not work

  • Resolved John Peden

    (@jcpeden)


    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)
  • Moderator Jan Dembowski

    (@jdembowski)

    Brute Squad and Volunteer Moderator

    We don’t support the Genesis framework here as that’s a commercial product and we do not have access to that code.

    But cheer up, I’ve reason to believe that the support there is very good. Why not head over to their forums and ask there?

    http://www.studiopress.com/support/

    Part of what you paid for was support and you may as well take advantage of that option.

    Ok thanks for the suggestion. I’ll ask on Studiopress.

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.