Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1188598

    hello,
    I have added latests news on our home page here https://napocatku.affe.cz/#novinky but when I click on next page (2, 3) it redirects me to https://napocatku.affe.cz/page/2/ or https://napocatku.affe.cz/page/3/ etc.
    However, I would like to stay in the same element (section) so something like https://napocatku.affe.cz/#novinky-2 I don’t want to scroll down every time I want to read earlier news.
    Thanks

    Michal

    #1189240

    Hey cukrmi,
    Sorry for the late reply, the only way I could find to change this is to append your section ID to the pagination links with jQuery.
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_pagination_script(){
      ?>
      <script>
    (function($){
      $(document).ready(function(){
    $(".pagination-wrap.pagination-slider nav.pagination a").each(function() {
       var $this = $(this);       
       var _href = $this.attr("href"); 
       $this.attr("href", _href + '#novinky');
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_pagination_script');

    also please ensure that this theme setting is disabled: Enfold Theme Options > Performance > Load jQuery in your footer

    Best regards,
    Mike

    #1189498

    This works wonderfully.
    Perfect!
    Thank you.

    #1189636

    Hi,

    Great, I’m glad that Mike could help you out. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1189681

    You can close this thread now.

    #1189891

    Hi,

    Thanks for letting us know, I’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Blog Posts – pagination (stay in the same element when go to next page)’ is closed to new replies.