• I’m missing something on how to call previous_post_link() inside of a function. I also tried assigning the output to a string variable and using that.

    function prevnext( $content ) {
       $content .= '<div>' . previous_post_link() . '-' . next_post_link() . '</div>';
       return $content;
    }
    add_action( 'the_content', 'prevnext', 4 );

    I get the hyphen – but not the links. Substituting another string variable also prints to the screen. I can use previous_post_link() in the page template and it works fine. What am I not doing right?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘previous_post_link inside of a function?’ is closed to new replies.