Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1053780
    tashitendrel
    Participant

    Hi,

    In order to add previous/next navigation to the portfolio item pages I have added this code from some advice given on this forum (https://community.theme.co/forums/topic/single-post-next-previous-arrow-navigation-like-ethos/) to my functions.php in renew child team:

    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\”></i>”;
    $prev_name = “<i class=\”x-icon-chevron-left\”></i> Previous Post”;
    $next_link = get_next_post() ? ‘ID ) . ‘”>’ . $prev_name . ‘‘ : ”;
    $prev_link = get_previous_post() ? ‘ID ) . ‘”>’ . $next_name . ‘‘ : ”;
    $posts = ‘<div class=”wp-post-navigation-next”>’.$next_link.$prev_link.'</div>’;
    return $content . $posts;
    } else {
    return $content;
    }
    }

    It looks OK, however incially the code was written for blog posts and I changed the line: if ( is_singular(‘post’) || is_singular( ‘x-portfolio’ ) ) {. Also, maybe it was meant for Ethos theme?

    Anyway, I have 2 issues with it now:
    – the previous/next appeares also in the SHARE THIS area in the sidebar. I would like to remove it from here. Screenshot attached
    – only on the mobile the navigation shows up on the top of the sidebar instead below portfolio item desctription. And again, it doubles in the SHARE IT area. Second screenshort attached.

    What should I change in this code?
    thank you

    #1053791
    tashitendrel
    Participant

    Just noticed that on the vertical tablet view of Appearance it looks the same like on mobile – navigation comes inside the sidebar area.

    #1053958
    Christopher
    Moderator

    Hi there,

    Please add following code in Customize -> Custom -> CSS :

    .entry-extra .wp-post-navigation-next {
        display: none;
    }
    
    @media (max-width:767px){
    .entry-extra {
        margin-top: 72px !important;
    }
    }
    

    Hope that helps.

    #1054336
    tashitendrel
    Participant

    thank you!

    #1054378
    Thai
    Moderator

    You’re most welcome 🙂

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