Plugin Author
YMC
(@wssoffice21)
Hi!
You should use a call to the magicGrid object inside the hook, for example, “ymc_after_loaded_data_545_1“
wp.hooks.addAction(‘ymc_after_loaded_data_545_1’, ‘smartfilter’, function(class_name, response) {
const magicGrid = new MagicGrid({
container: ‘.’ + class_name + ‘ .post-entry’,
items: response.post_count,
center: false,
gutter: 20
});
magicGrid.listen();
});
The width of each grid element is determined automatically depending on the container width. It is necessary to specify the element width. Then, you can set the parameters of the MagicGrid object you need using filters.
// Maximum number of columns
wp.hooks.addFilter(‘ymc_magicGrid_maxColumns’, ‘smartfilter’, ‘callback’); wp.hooks.addFilter(‘ymc_magicGrid_maxColumns_FilterID’, ‘smartfilter’, ‘callback’); wp.hooks.addFilter(‘ymc_magicGrid_maxColumns_FilterID_LayoutID’, ‘smartfilter’, ‘callback’);
Here is a link to the plugin documentation https://github.com/YMC-22/smart-filter#masonry-layout
-
This reply was modified 1 year, 1 month ago by
YMC.
-
This reply was modified 1 year, 1 month ago by
YMC.