Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1183759
    strandbein
    Participant

    Hello,

    I inserted the code described here https://community.theme.co/forums/topic/next-prev-button-in-blog-post/ in the functions.php of my child-theme, but only the text is showing “Next Post” and “Previous Post”, no icon. What can I do?

    #1183766
    strandbein
    Participant
    This reply has been marked as private.
    #1183875
    Jade
    Moderator

    Hi there,

    Please update the code you copied here to:

    add_action ('the_content', 'add_next_post_item_link' );
    
    function add_next_post_item_link ( $content ) {
    	if ( is_singular('post') || is_singular('x-portfolio') ) {
    		$next_name = "Next Post <i class=\"x-icon-chevron-right\" data-x-icon=\"\"></i>";
    		$prev_name = "<i class=\"x-icon-chevron-left\" data-x-icon=\"\"></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;
    	}
    }

    Hope this helps.

    #1184454
    strandbein
    Participant

    Cool! Thank You!

    #1184478
    Thai
    Moderator

    If you need anything else please let us know.

  • <script> jQuery(function($){ $("#no-reply-1183759 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>