Tagged: blog posts
Hey guys!
When visitors click to see the second page of posts (I use the blog posts section) they get booted to the top of the page. It throws visitors off and they bounce.
How can I set it so people stay at the bottom of the page when they click to see more posts so they don’t leave.
Hi Courtney!
Thank you for using Enfold.
Place the blog inside a color section. Edit the color section, apply a unique id to the Section ID field. Use “blog-section” for example. Add this in the functions.php file:
add_action('wp_footer', 'ava_custom_script', 10);
function ava_custom_script(){
?>
<script>
(function($){
var pagination = $("#top .pagination a"),
url = window.location.href,
initial = url.indexOf('/page/') >= 1;
if(pagination.length >= 1 && initial) {
$('html,body').animate({
scrollTop: $('#blog-section').offset().top
},2000);
}
}(jQuery));
</script>
<?php
}
Best regards,
Ismael
Thank you Ismael :)