Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1306802

    Hi,

    How can I add a LOAD MORE option to portfolio grid? It only allows pagination…

    Thanks

    #1306975

    Hey,

    Thanks for contacting us!

    Portfolio Grid does not support Load More button, Masonry element does. Have you tried using it? Here is an example from a demo site – https://kriesi.at/themes/enfold-2017/elements/masonry/ :)

    Best regards,
    Yigit

    #1306984

    Hi Yigit,

    I tried the Masonry element as well. It doesn’t allow opening links in a new tab. That’s why I turned to the portfolio grid.

    To try and solve the problem in the masonry element, I used this code (which I found here):

    function add_custom_target(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('.av-masonry-container a ').attr('target','_blank');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_target');

    It works only for the items the load on the first load but it doesn’t work for the items the load after LOAD MORE.
    Is there a fix to the code that would make the items that load after LOAD MORE also open in a new tab?

    #1307547

    Hi,
    Thank you for your patience, please try this script instead:

    function add_custom_target(){
    ?>
    <script>
    (function($){
    $('.av-masonry-container a ').attr('target','_blank');
    $('.av-masonry-load-more').click(function(){
    	setTimeout(function () {
    	$('.av-masonry-container a ').attr('target','_blank');
    	}, 1000);
    });
    }(jQuery));
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_target');

    it will run on load and on clicking of the “load more” button after waiting 1 second for the elements to be added.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.