How to deactivate AJAX in the blog module – Divi Theme

image 1
Contents

    The blog module uses AJAX to load older posts. If you click on the button for older entries, the blog module will reload instead of refreshing the entire page. This is how AJAX works.

    The pagination links have the?et_blog parameter to avoid conflicts with the main query during pagination. It has no effect on SEO as the URLs have the “canonical” URL set to the main page.

    In some cases, you may want to refresh the page to apply custom styles or to display the URL of the next page.

    To disable AJAX, enter this code in Divi> Theme options> Integration> Add code< Header> of your blog:

    <script>
    (function($) {
        $(document).ready(function() {
        
            $(".et_pb_module.et_pb_posts .pagination a, .et_pb_blog_grid .pagination a").click(function() {
                window.location.href = $(this).attr('href');
    
                return false;
            });
        
        });
    })(jQuery);
    </script>
    

    If you only need to deactivate AJAX on one page, you can insert this code into the code module.

    To disable AJAX for a specific blog module, add a custom CSS class to the “Advanced settings” tab of the module, for example:

    disable_ajax

    image 1
    Next, enter this code in Divi> Theme options> Integration> Add code< Header> of your blog:

    <script>
    (function($) {
        $(document).ready(function() {
       
            $(".disable_ajax .pagination a").click(function() {
                window.location.href = $(this).attr('href');
               
                return false;
            });
       
        });
    })(jQuery);
    </script>

    Dieser Beitrag ist auch verfügbar auf: Deutsch (German)

    Updated on 27. March 2024
    Was this article helpful?

    Leave a Reply

    Your email address will not be published. Required fields are marked *