Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #332314

    Marco
    Participant

    Hello,

    Is it possible to have the single post next-previous arrow-navigation from Ethos within the stack Renew?
    Would be great! πŸ™‚

    Thx in advanced!

    url: www . landelijk wonen magazine. nl
    theme: Renew

    #332405

    Nico
    Moderator

    Hi There,

    Thanks for writing in.

    You can check this link below maybe it would help because merging functions of stack is beyond the scope of our support.

    https://community.theme.co//forums/topic/next-and-previous-buttons-on-portfolio-item-single-post-i-only-see-arrows/

    Hope it helps.

    Thanks.

    #341756

    Marco
    Participant

    Sorry, did not help me πŸ™

    #341795

    Prasant Rai
    Moderator

    Hello Marco,

    Thanks for writing in!

    To setup next / previous button on blog post will require template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Kindly use following code in your child theme’s functions.php file:

    add_action ('the_content', 'add_next_post_item_link' );
    
    function add_next_post_item_link ( $content ) {
    	if ( is_singular('post') ) {
    		$next_name = "Next Post <i class=\"x-icon-chevron-right\"></i>";
    		$prev_name = "<i class=\"x-icon-chevron-left\"></i> Previous Post";
    		$next_link = get_next_post() ? '<a style="float: left;" href="' . get_permalink( get_next_post()->ID ) . '">' . $prev_name . '</a>' : '';
    		$prev_link = get_previous_post() ? '<a style="float: right;" href="' . get_permalink( get_previous_post()->ID ) . '">' . $next_name . '</a>' : '';
    		$posts = '<div class="wp-post-navigation-next">'.$next_link.$prev_link.'</div>';
    		return $content . $posts;
    	} else {
    		return $content;
    	}
    }

    Let us know how it goes.

    Thanks.

    #745926

    chchew
    Participant

    Hi,

    I added the codes in function.php and manage to get the two arrows. How can I configure the previous and next arrow such that it will go to a specific post that I wish?

    Thanks.

    #746208

    Rupok
    Member

    Hi there,

    Thanks for updating. It will automatically point to next post and previous post. If you want to link to any specific post then that will be unusual and you need to place hard coded link like –

    $next_link = '<a style="float: left;" href="http://linktoyourpost.com">Your Next Post Title</a>';

    Hope this helps.

    Cheers!

    #746800

    chchew
    Participant

    Thank you for clarifying. Assuming I have 10 posts all together. I realized I need to add a new post in between the 4th and 5th post in order to have a continuous flow of story. Using the default, previous and next post indicator, how can I influence such that inside the 4th post’s “next button”, it will point to a “New Post” instead of 5th post. Similarly, inside the 5th post, the “previous button” should now point to the “New Post” instead of 4th posts.

    #746944

    Lely
    Moderator

    Hello There,

    You’re welcome.
    Since next-previous is sorted in chronological order, you may want to edit POST DATE manually and make sure that the NEW POST date is between 4th and 5th post.
    You may check this link :https://codex.wordpress.org/Function_Reference/get_next_posts_link

    Hope this helps.