Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @anna2890

    Login Admin dashboard.

    Go Appearance >> editor on the right side you find “Templates” below that you find list files search functions.php there

    add_filter( 'the_content', 'next_prev_posts' );
    function next_prev_posts($content) {
    $pages = '';
    if (is_single()) { // only shows on single post, excluding is_page, is_attachment()
    $prev_post = get_previous_post();
    if (!empty( $prev_post )) { // previous post available
    $pages .= "Prev Post: $prev_post->post_title";
    }
    $next_post = get_next_post();
    if (!empty( $next_post )) { // next item available
    $pages .= " | Next Post: $next_post->post_title";
    }
    }
    return $content . $pages; // put the navigation at the end of the post content
    }

    Add this code and update the page.

    View post on imgur.com

    Hope this will Help.

    Thanks.

    Thread Starter anna2890

    (@anna2890)

    Hi @wbcomdesigns,
    unfortunately your code doesn’t work.
    Maybe I’m not being clear. In the bottom page I have to visualize image and title of prev and next article, and they must be clickable. With your code, I visualize only the title, without link, and not of same category.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Previous and Next link article’ is closed to new replies.