Hi,
How can I add a LOAD MORE option to portfolio grid? It only allows pagination…
Thanks
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
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?
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