
-
AuthorPosts
-
February 10, 2025 at 8:02 pm #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!
February 11, 2025 at 4:29 am #1476867Hey 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,
IsmaelFebruary 11, 2025 at 11:45 am #1476893hi,
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!
February 11, 2025 at 9:30 pm #1476910Hi,
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,
MikeFebruary 12, 2025 at 9:53 am #1476942Hi,
I am not using a child theme.
Is it possible to use lazy loading instead?Thank you!
February 12, 2025 at 4:49 pm #1476967Hi,
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:
and ensure that it is activated, then add the above code and save.Best regards,
MikeFebruary 12, 2025 at 7:06 pm #1476983thank 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_linkFebruary 12, 2025 at 11:08 pm #1476993Hi,
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,
MikeFebruary 13, 2025 at 1:01 pm #1477044Hi Mike,
Thank you very much!
Sent the credentials.February 13, 2025 at 7:40 pm #1477070February 14, 2025 at 8:04 am #1477105Hi Mike,
Thank you very very much for your help!
Now all works perfect!February 14, 2025 at 5:15 pm #1477125Hi,
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 -
AuthorPosts
- The topic ‘Pagination to open at the same anchor point and not at the beginning of the page’ is closed to new replies.