-
AuthorSearch Results
-
October 26, 2018 at 1:05 pm #191940
AnonymousInactiveHI.
Are there any guides on integrating search and filter pro with a masonry grid layout and an ajax load more button or an infinite scroll?Thanks!
October 15, 2018 at 1:57 pm #190978In reply to: Mansonry and AJAX Issues
AnonymousInactiveHi Trevor,
I’ve now added the following and masonry and AJAX is working…
$container.masonry('reloadItems');
I’ve placed this here…
$container.imagesLoaded(function () { // INITIALIZE MASONRY $container.masonry('reloadItems'); $container.masonry({
Thanks again for your assistance.
Regards,
Kirk
October 15, 2018 at 12:18 pm #190942In reply to: Mansonry and AJAX Issues
AnonymousInactiveHi Trevor,
The code you’ve provided has helped me re-initiate the masonry grid after a search has taken place, which was another problem that I need to overcome.
I’ve modified the code slightly for responsiveness…
(function ($) { "use strict"; function loadMasonry(){ //$container will always be a new copy var $container = $('.search-filter-results-list'); //running images loaded again after page load / ajax event $container.imagesLoaded(function () { // INITIALIZE MASONRY $container.masonry({ itemSelector: '.search-filter-result-item', columnWidth: '.grid-sizer', gutter: '.gutter-sizer', percentPosition: true, horizontalOrder: true }); // Masonry has been initialized, okay to call methods // not sure if you will need this here but might be worth adding in //$container.masonry('reloadItems'); }); } //then also call it after ajax event $(document).on("sf:ajaxfinish", ".searchandfilter", function () { console.log("ajax complete"); loadMasonry(); }); //an event fired when S&F is initialised and S&F scripts have been loaded $(document).on("sf:init", ".searchandfilter", function(){ console.log("S&F JS initialised"); loadMasonry(); }); }(jQuery));
I’m still having issues with the next items loading in via AJAX in a masonry layout though.
https://mgg.devrap.co.uk/I’m currently investigating, but if you have any further suggestions, please let me know.
Thanks for your time so far.
Regards,
Kirk
October 15, 2018 at 11:13 am #190937In reply to: Mansonry and AJAX Issues
TrevorParticipantGreat to speak with you Kirk. You are going to have a look and see if this code example is of any use to you:
<script>(function ($) { function loadMasonry(){ //$container will always be a new copy var $container = $('.ae-post-widget-wrapper'); //running images loaded again after page load / ajax event $container.imagesLoaded(function () { // INITIALIZE MASONRY $container.masonry({ itemSelector: '.entry', columnWidth: '.entry', gutter: 40, }); // Masonry has been initialized, okay to call methods // not sure if you will need this here but might be worth adding in //$container.masonry('reloadItems'); }); } //then also call it after ajax event $(document).on("sf:ajaxfinish", ".searchandfilter", function () { console.log("ajax complete"); loadMasonry(); }); }(jQuery));</script>
October 12, 2018 at 9:46 am #190849In reply to: Mansonry and AJAX Issues
AnonymousInactiveHi Trevor,
The link now shows where I was at… https://mgg.devrap.co.uk/
Results per page are currently set to 20, but when reduced to 6 (or anything lower than total items) and the Masonry Ajax code added, that’s what was giving me the obscure display issues that were happening when I made the original post.
What you were seeing yesterday, were the results of installing the Post Grid plugin.
I’ve custom coded the masonry functionality based on the documentation and libraries here… https://masonry.desandro.com/
I’m using the following theme… https://themble.com/bones/
We use the WP Bakery plugin on most of our sites, but I’m not sure it’s necessary for this website.
WP Bakery grids don’t offer enough filtering and search options, which is why we purchased your plugin.Long-term, I need to create a load of custom taxonomies to fully utilise your plugin but was trying to get the masonry and AJAX working together first.
Regards,
Kirk
October 11, 2018 at 3:09 pm #190762In reply to: Mansonry and AJAX Issues
TrevorParticipantHi Kirk
If you had added some quite unusual data (terms) into the search results, maybe the Post grid plugin is not the ideal route.
If you are using Masonry, where did this originate from? Your theme? I also see you have WPBakery Page Builder installed.
What sort of data are you outputting in each post (Featured Image, Title, Excerpt, Date, Categories etc.)?
If it is ‘merely’ what is one your home page, what customisation needs doing? What I see there can be done by the Page Builder plugin.
October 5, 2018 at 9:46 am #190190In reply to: Customer option to display only in-stock product
TrevorParticipantAh, I see, he added this:
(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); var isocontainer = $('.reinit-isotope'), iso_selector = $('.reinit-isotope').data('iso-selector'); isocontainer.isotopeb('destroy'); isocontainer.isotopeb({masonry: {columnWidth: iso_selector}, layoutMode:'fitRows', transitionDuration: '0.8s'}); if(isocontainer.attr('data-fade-in') == 1) { var isochild = isocontainer.find('.kt_item_fade_in'); isochild.each(function(i){ $(this).delay(i*150).animate({'opacity':1},350); }); } }); }(jQuery));
October 1, 2018 at 4:01 pm #189823In reply to: Customer option to display only in-stock product
TrevorParticipantThe gaps thing. My basic script would look something like this:
(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); var $container = $('.reinit-isotope'), iso_selector = $('.reinit-isotope').data('iso-selector'); $container.isotopeb({masonry: {columnWidth: iso_selector}, transitionDuration: '0s'}); }); }(jQuery));
It would have to be inside script tags or in the Simple Custom CSs and javascript plugin (which does the script tags for you).
September 28, 2018 at 6:52 pm #189722In reply to: Customer option to display only in-stock product
AnonymousInactiveHeard back from Ben:
I suggest adding this css:
#topbar-search form {
border: 1px solid #999;
}
#topbar-search .search-icon {
color: #444;
}
#topbar-search .form-search ::-webkit-input-placeholder {
color: #555;
}
#topbar-search .form-search ::-moz-placeholder {
color: #555;
}
#topbar-search .form-search :-ms-input-placeholder {
color: #555;
}
The search form file is searchform.php. It’s in the main folder of the theme.Here is how you can re-load isotope on an event:
$(window).on(‘customEvent’, function( event ) {
var $container = $(‘.reinit-isotope’),
iso_selector = $(‘.reinit-isotope’).data(‘iso-selector’);
$container.isotopeb({masonry: {columnWidth: iso_selector}, transitionDuration: ‘0s’});
});
If you can tell me what event the plugin uses on a filter I can get you exactly what you need. Also, you could use a different search output that doesn’t use a grid if you like. That is controlled in your theme options > misc settings.In a second response, he wrote:
Just thought of this. You don’t have to use the normal search. You can add any widget or shortcode into your topbar so if you don’t want to override files you can just add the plugins search shortcode into the topbar and turn off the search that is there.
Any suggestions?
September 26, 2018 at 4:12 pm #189426In reply to: Post alignment problem or Post spacing problem
TrevorParticipantThe key is to find out what the masonry function is that does this. You can get some ideas from the documentation relating to Elementor (i will not all be applicable, as it is specific to Elementor Pro, but some of what is there will be relevant):
https://searchandfilter.com/documentation/3rd-party/elementor/
The code you see about Masonry and Ajax would have a similar solution, replacing this line:
elementorFrontend.init();
With whatever your theme does to initiate Masonry.
-
AuthorSearch Results
-
Search Results
-
HI.
Are there any guides on integrating search and filter pro with a masonry grid layout and an ajax load more button or an infinite scroll?Thanks!