• Resolved Greg McEwan-Marriott

    (@gregthebuzz)


    Hi I read yer GitHub examples but have no clue how to set masonry columns to 4

    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’);


Viewing 1 replies (of 1 total)
  • 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.
Viewing 1 replies (of 1 total)

The topic ‘Masonry Max Columns’ is closed to new replies.