Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1277399
    sandra.i
    Participant

    Hi

    I’ve used this code to insert Next/Previous links for posts on the post page – how can I add a class tag so that I can style them?

    function x_post_navigations () {
    previous_post_link( '<strong>%link</strong>','Previous' ); echo '|'; next_post_link( '<strong>%link</strong>','Next' );
    }
    
    add_action ('x_after_view_renew_content', 'x_post_navigations');
    add_action ('x_after_view_renew_content-audio', 'x_post_navigations');
    add_action ('x_after_view_renew_content-gallery', 'x_post_navigations');
    add_action ('x_after_view_renew_content-image', 'x_post_navigations');
    add_action ('x_after_view_renew_content-link', 'x_post_navigations');
    add_action ('x_after_view_renew_content-quote', 'x_post_navigations');
    add_action ('x_after_view_renew_content-video', 'x_post_navigations');
    #1277404
    sandra.i
    Participant

    Also the Next/Previous links are showing on the top of my blog page, behind images and text:

    http://www.rochesterclinic.co.uk/news/

    Could you have a look?

    Thanks

    #1277475
    Christian
    Moderator

    Hey there,

    Add class to the strong tag like this:

    <strong class="prev">%link</strong>

    Then you can target the link by

    .prev a

    Thanks.

    #1277535
    sandra.i
    Participant

    Hi

    Thanks that works great. How can I add some padding to the top of the links..?

    Thanks

    #1277581
    Rupok
    Member

    Hi there,

    It looks like this on my end – http://prntscr.com/de3z0a

    That’s what you see on your end as well? Where you exactly need the padding?

    Let us know.

    #1277649
    sandra.i
    Participant
    This reply has been marked as private.
    #1277706
    Rupok
    Member

    Hi there,

    Thanks for writing back.

    #1. Next/Previous link not supposed to be on blog page as it doesn’t make any sense. Blog page will list the posts, why you need them there? Perhaps you are trying to achieve this through custom code but it’s not usual and such customization is out of our support scope.

    #2. It seems you already tried this CSS :

    .prev_next {
      padding-top: 20px;
    }

    Let’s update this to following :

    .prev_next {
      display: inline-block;
      padding-top: 20px;
    }

    Hope this helps.

    #1277710
    sandra.i
    Participant

    Hi

    1. Yes, the next-previous link is not supposed to be on the blog page, but that’s where is appears, can you remove it?

    2. the css worked great, thanks!

    #1277822
    Nabeel A
    Moderator

    Hi again,

    Please add the following code in your Customizer

    .blog .prev_next {
        display: none !important;
    }

    Let us know how this goes!

    #1277914
    sandra.i
    Participant

    Thanks, almost! The previous/next links are gone but the divider is still there – ‘|’

    #1278202
    Rad
    Moderator

    Hi there,

    Please change this code

    function x_post_navigations () {
    previous_post_link( '<strong>%link</strong>','Previous' ); echo '|'; next_post_link( '<strong>%link</strong>','Next' );
    }

    to this

    function x_post_navigations () {
    echo '<div class="prev_next_nav">'; previous_post_link( '<strong>%link</strong>','Previous' ); echo '|'; next_post_link( '<strong>%link</strong>','Next' ); echo '</div>';
    }

    Then change that CSS to this

    .blog .prev_next_nav{
        display: none !important;
    }

    Hope this helps.

    #1278578
    sandra.i
    Participant

    Perfect, thanks!

    #1278589
    Rue Nel
    Moderator

    You’re welcome!
    We’re glad we were able to help you out.

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