vc-masonry-media-grid.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. require_once vc_path_dir( 'SHORTCODES_DIR', 'vc-media-grid.php' );
  6. /**
  7. * Class WPBakeryShortCode_Vc_Masonry_Media_Grid
  8. */
  9. class WPBakeryShortCode_Vc_Masonry_Media_Grid extends WPBakeryShortCode_Vc_Media_Grid {
  10. public function shortcodeScripts() {
  11. parent::shortcodeScripts();
  12. wp_register_script( 'vc_masonry', vc_asset_url( 'lib/bower/masonry/dist/masonry.pkgd.min.js' ), array(), WPB_VC_VERSION, true );
  13. }
  14. public function enqueueScripts() {
  15. wp_enqueue_script( 'vc_masonry' );
  16. parent::enqueueScripts();
  17. }
  18. public function buildGridSettings() {
  19. parent::buildGridSettings();
  20. $this->grid_settings['style'] .= '-masonry';
  21. }
  22. /**
  23. * @param $grid_style
  24. * @param $settings
  25. * @param $content
  26. * @return string
  27. */
  28. protected function contentAllMasonry( $grid_style, $settings, $content ) {
  29. return parent::contentAll( $grid_style, $settings, $content );
  30. }
  31. /**
  32. * @param $grid_style
  33. * @param $settings
  34. * @param $content
  35. * @return string
  36. */
  37. protected function contentLazyMasonry( $grid_style, $settings, $content ) {
  38. return parent::contentLazy( $grid_style, $settings, $content );
  39. }
  40. /**
  41. * @param $grid_style
  42. * @param $settings
  43. * @param $content
  44. * @return string
  45. */
  46. protected function contentLoadMoreMasonry( $grid_style, $settings, $content ) {
  47. return parent::contentLoadMore( $grid_style, $settings, $content );
  48. }
  49. }