Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1476842

    Hi,

    I have added a magazine section on this page https://stage3.studiocampaner.ro but, when I click on page 2, upon refresh it takes me to the beginning of the page. How can I make it in sucha way that, when clicking on page 2, to go the same section instead of top of the page?

    Thank you!

    #1476867

    Hey tcampaner,

    Thank you for the inquiry.

    Edit the Magazine element, apply a Custom ID (e.g., “magblog”) in Advanced > Developer Settings, then add this script to the functions.php file:

    function ava_custom_script_pagination_anchor(){
    ?>
    <script>
    	(function($) {
    		$(document).ready(function(){
    			$("nav.pagination a").each(function(){
    				var theLink = $(this).attr("href");
    				$(this).attr("href", theLink + "#magblog");
    			});
    		});
    	})(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'ava_custom_script_pagination_anchor', 9999);
    

    The script should apply the blog anchor to the pagination links. Let us know how it goes.

    Best regards,
    Ismael

    #1476893

    hi,

    Thank you very much for your reply!
    Is there a possibility to use CSS instead? I am not that familiar with the php and I am afraid to make some damages to the files.

    Thank you!

    #1476910

    Hi,
    Please use the PHP code in your Child Theme functions.php,
    We don’t expect any issues using a child theme. You will need to use a child theme or the code will be lost with your next update.

    Best regards,
    Mike

    #1476942

    Hi,

    I am not using a child theme.
    Is it possible to use lazy loading instead?

    Thank you!

    #1476967

    Hi,
    I don’t believe that lazy loading will work in this case.
    If you are not using a child theme you could use the WP Code plugin then add a new snippet, in the top right corner use the PHP snippet as the code type:
    use wpcode php snippet and activate
    and ensure that it is activated, then add the above code and save.

    Best regards,
    Mike

    #1476983

    thank you very much for the alternative!
    this is a great way to add code without touching the php file itself!

    I have done what you said (I think), but is still not working. Please see print screens.
    https://drive.google.com/drive/folders/1ArPb35TGxJ0cDF2aFpe2duu4fBi1A7ue?usp=share_link

    #1476993

    Hi,
    I can not see your screenshot as it requires a login, please include an admin login in the Private Content area so we can examine.
    Please note that in some rare cases that the PHP code added this way will not work, but most likely your code was copied from an email and not the forum, so the characters were changed and won’t work, so the code needs to be corrected. We won’t know until we can check with a admin login.

    Best regards,
    Mike

    #1477044

    Hi Mike,

    Thank you very much!
    Sent the credentials.

    #1477070

    Hi,
    You had two issues, you didn’t and the magblog ID to the magazine element:
    Enfold Support 6583
    and you had Load jQuery In Your Footer enabled at Enfold Theme Options ▸ Performance ▸ Load jQuery in your footer
    I corrected and it now works, Please clear your browser cache and check.

    Best regards,
    Mike

    #1477105

    Hi Mike,

    Thank you very very much for your help!
    Now all works perfect!

    #1477125

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Pagination to open at the same anchor point and not at the beginning of the page’ is closed to new replies.