Advertisement
daymobrew

Post grid and filter ultimate - support layoutMode

Feb 23rd, 2024
1,623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.31 KB | Source Code | 0 0
  1. --- post-grid-and-filter-ultimate/assets/js/pgafu-public.js.orig    2021-01-28 08:40:04.000000000 +0000
  2. +++ post-grid-and-filter-ultimate/assets/js/pgafu-public.js 2024-02-22 18:21:03.405981500 +0000
  3. @@ -189,6 +189,7 @@
  4.                 jQuery('#'+filter_container).isotope({
  5.                     itemSelector    : '.pgafu-post-cnt',
  6.                     filter          : active_attr,
  7. +                   layoutMode      : PGAGFU.layoutMode,
  8.                 });
  9.  
  10.                 jQuery(document).on('click', '#'+filter_id+' li', function() {
  11. --- post-grid-and-filter-ultimate/includes/class-pgafu-script.php.orig  2023-06-02 02:43:58.000000000 +0100
  12. +++ post-grid-and-filter-ultimate/includes/class-pgafu-script.php   2024-02-23 15:17:29.976274500 +0000
  13. @@ -125,6 +125,14 @@
  14.             wp_enqueue_style( 'pgafu-admin-style');
  15.         }
  16.  
  17. +       // Allow for different layout mode (default is 'masonry');
  18. +       $default_layout_mode = 'masonry';
  19. +       $layout_mode = apply_filters( 'pgafu_isotope_layoutmode', $default_layout_mode );
  20. +       // Ensure the mode is one of the permitted types.
  21. +       if ( ! in_array( $layout_mode, array( 'masonry', 'fitRows', 'vertical', 'packery', 'cellsByRow', 'masonryHorizontal', 'fitColumns', 'cellsByColumn', 'horiz' ) ) ) {
  22. +           $layout_mode = $default_layout_mode;
  23. +       }
  24. +       wp_add_inline_script( 'pgafu-public-js', 'const PGAGFU = ' . json_encode( array( 'layoutMode' => "$layout_mode" ) ) );
  25.     }
  26.  }
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement