Advertisement
SRD75

Blog-ASC.php

Apr 23rd, 2022
3,216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 74.32 KB | None | 0 0
  1. <?php
  2.  
  3. get_template_part( '/includes/builder/module/helpers/Overlay.php' );
  4.  
  5. class ET_Builder_Module_Blog_ASC extends ET_Builder_Module_Type_PostBased {
  6.     /**
  7.      * Track if the module is currently rendering to prevent unnecessary rendering and recursion.
  8.      *
  9.      * @var bool
  10.      */
  11.     protected static $rendering = false;
  12.  
  13.     function init() {
  14.         $this->name             = esc_html__( 'Blog-ASC', 'et_builder' );
  15.         $this->plural           = esc_html__( 'Blogs-ASC', 'et_builder' );
  16.         $this->slug             = 'et_pb_blog_asc';
  17.         $this->vb_support       = 'off';
  18.         $this->main_css_element = '%%order_class%% .et_pb_post';
  19.  
  20.         $this->settings_modal_toggles = array(
  21.             'general'  => array(
  22.                 'toggles' => array(
  23.                     'main_content' => et_builder_i18n( 'Content' ),
  24.                     'elements'     => et_builder_i18n( 'Elements' ),
  25.                 ),
  26.             ),
  27.             'advanced' => array(
  28.                 'toggles' => array(
  29.                     'layout'  => et_builder_i18n( 'Layout' ),
  30.                     'overlay' => et_builder_i18n( 'Overlay' ),
  31.                     'image'   => array(
  32.                         'title'    => et_builder_i18n( 'Image' ),
  33.                         'priority' => 49,
  34.                     ),
  35.                     'text'    => array(
  36.                         'title'    => et_builder_i18n( 'Text' ),
  37.                         'priority' => 51,
  38.                     ),
  39.                 ),
  40.             ),
  41.         );
  42.  
  43.         $this->advanced_fields = array(
  44.             'fonts'          => array(
  45.                 'header'     => array(
  46.                     'label'        => et_builder_i18n( 'Title' ),
  47.                     'css'          => array(
  48.                         'main'         => "{$this->main_css_element} .entry-title, %%order_class%% .not-found-title",
  49.                         'font'         => "{$this->main_css_element} .entry-title a, %%order_class%% .not-found-title",
  50.                         'color'        => "{$this->main_css_element} .entry-title a, %%order_class%% .not-found-title",
  51.                         'limited_main' => "{$this->main_css_element} .entry-title, {$this->main_css_element} .entry-title a, %%order_class%% .not-found-title",
  52.                         'hover'        => "{$this->main_css_element}:hover .entry-title, {$this->main_css_element}:hover .entry-title:hover a, %%order_class%% .not-found-title",
  53.                         'color_hover'  => "{$this->main_css_element}:hover .entry-title a, %%order_class%%:hover .not-found-title",
  54.                         'important'    => 'all',
  55.                     ),
  56.                     'header_level' => array(
  57.                         'default'          => 'h2',
  58.                         'computed_affects' => array(
  59.                             '__posts',
  60.                         ),
  61.                     ),
  62.                 ),
  63.                 'body'       => array(
  64.                     'label'          => et_builder_i18n( 'Body' ),
  65.                     'css'            => array(
  66.                         'main'         => "{$this->main_css_element} .post-content, %%order_class%%.et_pb_bg_layout_light .et_pb_post .post-content p, %%order_class%%.et_pb_bg_layout_dark .et_pb_post .post-content p",
  67.                         'color'        => "{$this->main_css_element}, {$this->main_css_element} .post-content *",
  68.                         'line_height'  => "{$this->main_css_element} p",
  69.                         'limited_main' => "{$this->main_css_element}, %%order_class%%.et_pb_bg_layout_light .et_pb_post .post-content p, %%order_class%%.et_pb_bg_layout_dark .et_pb_post .post-content p, %%order_class%%.et_pb_bg_layout_light .et_pb_post a.more-link, %%order_class%%.et_pb_bg_layout_dark .et_pb_post a.more-link",
  70.                         'hover'        => "{$this->main_css_element}:hover .post-content, %%order_class%%.et_pb_bg_layout_light:hover .et_pb_post .post-content p, %%order_class%%.et_pb_bg_layout_dark:hover .et_pb_post .post-content p",
  71.                         'color_hover'  => "{$this->main_css_element}:hover, {$this->main_css_element}:hover .post-content *",
  72.                     ),
  73.                     'block_elements' => array(
  74.                         'tabbed_subtoggles' => true,
  75.                         'bb_icons_support'  => true,
  76.                         'css'               => array(
  77.                             'link'           => "{$this->main_css_element} .post-content a, %%order_class%%.et_pb_bg_layout_light .et_pb_post .post-content a, %%order_class%%.et_pb_bg_layout_dark .et_pb_post .post-content a",
  78.                             'ul'             => "{$this->main_css_element} .post-content ul li, %%order_class%%.et_pb_bg_layout_light .et_pb_post .post-content ul li, %%order_class%%.et_pb_bg_layout_dark .et_pb_post .post-content ul li",
  79.                             'ul_item_indent' => "{$this->main_css_element} .post-content ul, %%order_class%%.et_pb_bg_layout_light .et_pb_post .post-content ul, %%order_class%%.et_pb_bg_layout_dark .et_pb_post .post-content ul",
  80.                             'ol'             => "{$this->main_css_element} .post-content ol li, %%order_class%%.et_pb_bg_layout_light .et_pb_post .post-content ol li, %%order_class%%.et_pb_bg_layout_dark .et_pb_post .post-content ol li",
  81.                             'ol_item_indent' => "{$this->main_css_element} .post-content ol, %%order_class%%.et_pb_bg_layout_light .et_pb_post .post-content ol, %%order_class%%.et_pb_bg_layout_dark .et_pb_post .post-content ol",
  82.                             'quote'          => "{$this->main_css_element} .post-content blockquote, %%order_class%%.et_pb_bg_layout_light .et_pb_post .post-content blockquote, %%order_class%%.et_pb_bg_layout_dark .et_pb_post .post-content blockquote",
  83.                         ),
  84.                     ),
  85.                 ),
  86.                 'meta'       => array(
  87.                     'label' => esc_html__( 'Meta', 'et_builder' ),
  88.                     'css'   => array(
  89.                         'main'         => "{$this->main_css_element} .post-meta, {$this->main_css_element} .post-meta a",
  90.                         'limited_main' => "{$this->main_css_element} .post-meta, {$this->main_css_element} .post-meta a, {$this->main_css_element} .post-meta span",
  91.                         'hover'        => "{$this->main_css_element}:hover .post-meta, {$this->main_css_element}:hover .post-meta a, {$this->main_css_element}:hover .post-meta span",
  92.                     ),
  93.                 ),
  94.                 'read_more'  => array(
  95.                     'label'           => esc_html__( 'Read More', 'et_builder' ),
  96.                     'css'             => array(
  97.                         'main'  => "{$this->main_css_element} div.post-content a.more-link",
  98.                         'hover' => "{$this->main_css_element} div.post-content a.more-link:hover",
  99.                     ),
  100.                     'hide_text_align' => true,
  101.                 ),
  102.                 'pagination' => array(
  103.                     'label'           => esc_html__( 'Pagination', 'et_builder' ),
  104.                     'css'             => array(
  105.                         'main'       => function_exists( 'wp_pagenavi' ) ? '%%order_class%% .wp-pagenavi a, %%order_class%% .wp-pagenavi span' : '%%order_class%% .pagination a',
  106.                         'important'  => function_exists( 'wp_pagenavi' ) ? 'all' : array(),
  107.                         'text_align' => '%%order_class%% .wp-pagenavi',
  108.                         'hover'      => function_exists( 'wp_pagenavi' ) ? '%%order_class%% .wp-pagenavi a:hover, %%order_class%% .wp-pagenavi span:hover' : '%%order_class%% .pagination a:hover',
  109.                     ),
  110.                     'hide_text_align' => ! function_exists( 'wp_pagenavi' ),
  111.                     'text_align'      => array(
  112.                         'options' => et_builder_get_text_orientation_options( array( 'justified' ), array() ),
  113.                     ),
  114.                 ),
  115.             ),
  116.             'background'     => array(
  117.                 'css' => array(
  118.                     'main' => '%%order_class%%',
  119.                 ),
  120.             ),
  121.             'borders'        => array(
  122.                 'default'   => array(
  123.                     'css'             => array(
  124.                         'main' => array(
  125.                             'border_radii'        => '%%order_class%% .et_pb_blog_grid .et_pb_post',
  126.                             'border_styles'       => '%%order_class%% .et_pb_blog_grid .et_pb_post',
  127.                             'border_styles_hover' => '%%order_class%% .et_pb_blog_grid .et_pb_post:hover',
  128.                         ),
  129.                     ),
  130.                     'depends_on'      => array( 'fullwidth' ),
  131.                     'depends_show_if' => 'off',
  132.                     'defaults'        => array(
  133.                         'border_radii'  => 'on||||',
  134.                         'border_styles' => array(
  135.                             'width' => '1px',
  136.                             'color' => '#d8d8d8',
  137.                             'style' => 'solid',
  138.                         ),
  139.                     ),
  140.                     'label_prefix'    => esc_html__( 'Grid Layout', 'et_builder' ),
  141.                 ),
  142.                 'fullwidth' => array(
  143.                     'css'             => array(
  144.                         'main' => array(
  145.                             'border_radii'  => '%%order_class%%:not(.et_pb_blog_grid_wrapper) .et_pb_post',
  146.                             'border_styles' => '%%order_class%%:not(.et_pb_blog_grid_wrapper) .et_pb_post',
  147.                         ),
  148.                     ),
  149.                     'depends_on'      => array( 'fullwidth' ),
  150.                     'depends_show_if' => 'on',
  151.                     'defaults'        => array(
  152.                         'border_radii'  => 'on||||',
  153.                         'border_styles' => array(
  154.                             'width' => '0px',
  155.                             'color' => '#333333',
  156.                             'style' => 'solid',
  157.                         ),
  158.                     ),
  159.                 ),
  160.                 'image'     => array(
  161.                     'css'          => array(
  162.                         'main' => array(
  163.                             'border_radii'  => '%%order_class%% .et_pb_post .entry-featured-image-url img, %%order_class%% .et_pb_post .et_pb_slides, %%order_class%% .et_pb_post .et_pb_video_overlay',
  164.                             'border_styles' => '%%order_class%% .et_pb_post .entry-featured-image-url img, %%order_class%% .et_pb_post .et_pb_slides, %%order_class%% .et_pb_post .et_pb_video_overlay',
  165.                         ),
  166.                     ),
  167.                     'label_prefix' => et_builder_i18n( 'Image' ),
  168.                     'tab_slug'     => 'advanced',
  169.                     'toggle_slug'  => 'image',
  170.                 ),
  171.             ),
  172.             'box_shadow'     => array(
  173.                 'default' => array(),
  174.                 'image'   => array(
  175.                     'label'             => esc_html__( 'Image Box Shadow', 'et_builder' ),
  176.                     'option_category'   => 'layout',
  177.                     'tab_slug'          => 'advanced',
  178.                     'toggle_slug'       => 'image',
  179.                     'css'               => array(
  180.                         'main'    => '%%order_class%% .entry-featured-image-url, %%order_class%% img, %%order_class%% .et_pb_slides, %%order_class%% .et_pb_video_overlay',
  181.                         'overlay' => 'inset',
  182.                     ),
  183.                     'default_on_fronts' => array(
  184.                         'color'    => '',
  185.                         'position' => '',
  186.                     ),
  187.                 ),
  188.             ),
  189.             'height'         => array(
  190.                 'css' => array(
  191.                     'main' => '%%order_class%%',
  192.                 ),
  193.             ),
  194.             'margin_padding' => array(
  195.                 'css' => array(
  196.                     'main'      => '%%order_class%%',
  197.                     'important' => array( 'custom_margin' ),
  198.                 ),
  199.             ),
  200.             'text'           => array(
  201.                 'use_background_layout' => true,
  202.                 'css'                   => array(
  203.                     'text_shadow' => '%%order_class%%',
  204.                 ),
  205.                 'options'               => array(
  206.                     'background_layout' => array(
  207.                         'depends_show_if'  => 'on',
  208.                         'default_on_front' => 'light',
  209.                         'hover'            => 'tabs',
  210.                     ),
  211.                 ),
  212.             ),
  213.             'filters'        => array(
  214.                 'css'                  => array(
  215.                     'main' => '%%order_class%%',
  216.                 ),
  217.                 'child_filters_target' => array(
  218.                     'tab_slug'    => 'advanced',
  219.                     'toggle_slug' => 'image',
  220.                 ),
  221.             ),
  222.             'image'          => array(
  223.                 'css' => array(
  224.                     'main' => implode(
  225.                         ', ',
  226.                         array(
  227.                             '%%order_class%% img',
  228.                             '%%order_class%% .et_pb_slides',
  229.                             '%%order_class%% .et_pb_video_overlay',
  230.                         )
  231.                     ),
  232.                 ),
  233.             ),
  234.             'scroll_effects' => array(
  235.                 'grid_support' => 'yes',
  236.             ),
  237.             'button'         => false,
  238.         );
  239.  
  240.         $this->custom_css_fields = array(
  241.             'title'          => array(
  242.                 'label'    => et_builder_i18n( 'Title' ),
  243.                 'selector' => '.entry-title',
  244.             ),
  245.             'content'        => array(
  246.                 'label'    => et_builder_i18n( 'Body' ),
  247.                 'selector' => '.post-content',
  248.             ),
  249.             'post_meta'      => array(
  250.                 'label'    => esc_html__( 'Post Meta', 'et_builder' ),
  251.                 'selector' => '.post-meta',
  252.             ),
  253.             'pagenavi'       => array(
  254.                 'label'    => esc_html__( 'Pagenavi', 'et_builder' ),
  255.                 'selector' => '.wp_pagenavi',
  256.             ),
  257.             'featured_image' => array(
  258.                 'label'    => esc_html__( 'Featured Image', 'et_builder' ),
  259.                 'selector' => '.entry-featured-image-url img',
  260.             ),
  261.             'read_more'      => array(
  262.                 'label'    => esc_html__( 'Read More Button', 'et_builder' ),
  263.                 'selector' => 'a.more-link',
  264.             ),
  265.         );
  266.  
  267.         $this->help_videos = array(
  268.             array(
  269.                 'id'   => 'PRaWaGI75wc',
  270.                 'name' => esc_html__( 'An introduction to the Blog module', 'et_builder' ),
  271.             ),
  272.             array(
  273.                 'id'   => 'jETCzKVv6P0',
  274.                 'name' => esc_html__( 'How To Use Divi Blog Post Formats', 'et_builder' ),
  275.             ),
  276.         );
  277.     }
  278.  
  279.     function get_fields() {
  280.         $fields = array(
  281.             'fullwidth'                     => array(
  282.                 'label'            => et_builder_i18n( 'Layout' ),
  283.                 'type'             => 'select',
  284.                 'option_category'  => 'layout',
  285.                 'options'          => array(
  286.                     'on'  => esc_html__( 'Fullwidth', 'et_builder' ),
  287.                     'off' => esc_html__( 'Grid', 'et_builder' ),
  288.                 ),
  289.                 'affects'          => array(
  290.                     'background_layout',
  291.                     'masonry_tile_background_color',
  292.                     'border_radii_fullwidth',
  293.                     'border_styles_fullwidth',
  294.                     'border_radii',
  295.                     'border_styles',
  296.                 ),
  297.                 'description'      => esc_html__( 'Toggle between the various blog layout types.', 'et_builder' ),
  298.                 'computed_affects' => array(
  299.                     '__posts',
  300.                 ),
  301.                 'tab_slug'         => 'advanced',
  302.                 'toggle_slug'      => 'layout',
  303.                 'default_on_front' => 'on',
  304.             ),
  305.             'use_current_loop'              => array(
  306.                 'label'            => esc_html__( 'Posts For Current Page', 'et_builder' ),
  307.                 'type'             => 'yes_no_button',
  308.                 'option_category'  => 'configuration',
  309.                 'options'          => array(
  310.                     'on'  => et_builder_i18n( 'Yes' ),
  311.                     'off' => et_builder_i18n( 'No' ),
  312.                 ),
  313.                 'description'      => esc_html__( 'Display posts for the current page. Useful on archive and index pages.', 'et_builder' ),
  314.                 'computed_affects' => array(
  315.                     '__posts',
  316.                 ),
  317.                 'toggle_slug'      => 'main_content',
  318.                 'default'          => 'off',
  319.                 'show_if'          => array(
  320.                     'function.isTBLayout' => 'on',
  321.                 ),
  322.             ),
  323.             'post_type'                     => array(
  324.                 'label'            => esc_html__( 'Post Type', 'et_builder' ),
  325.                 'type'             => 'select',
  326.                 'option_category'  => 'configuration',
  327.                 'options'          => et_get_registered_post_type_options( false, false ),
  328.                 'description'      => esc_html__( 'Choose posts of which post type you would like to display.', 'et_builder' ),
  329.                 'computed_affects' => array(
  330.                     '__posts',
  331.                 ),
  332.                 'toggle_slug'      => 'main_content',
  333.                 'default'          => 'post',
  334.                 'show_if'          => array(
  335.                     'use_current_loop' => 'off',
  336.                 ),
  337.             ),
  338.             'posts_number'                  => array(
  339.                 'label'            => esc_html__( 'Post Count', 'et_builder' ),
  340.                 'type'             => 'text',
  341.                 'option_category'  => 'configuration',
  342.                 'description'      => esc_html__( 'Choose how much posts you would like to display per page.', 'et_builder' ),
  343.                 'computed_affects' => array(
  344.                     '__posts',
  345.                 ),
  346.                 'toggle_slug'      => 'main_content',
  347.                 'default'          => 10,
  348.             ),
  349.             'include_categories'            => array(
  350.                 'label'            => esc_html__( 'Included Categories', 'et_builder' ),
  351.                 'type'             => 'categories',
  352.                 'meta_categories'  => array(
  353.                     'all'     => esc_html__( 'All Categories', 'et_builder' ),
  354.                     'current' => esc_html__( 'Current Category', 'et_builder' ),
  355.                 ),
  356.                 'option_category'  => 'basic_option',
  357.                 'renderer_options' => array(
  358.                     'use_terms' => false,
  359.                 ),
  360.                 'description'      => esc_html__( 'Choose which categories you would like to include in the feed.', 'et_builder' ),
  361.                 'toggle_slug'      => 'main_content',
  362.                 'computed_affects' => array(
  363.                     '__posts',
  364.                 ),
  365.                 'show_if'          => array(
  366.                     'use_current_loop' => 'off',
  367.                     'post_type'        => 'post',
  368.                 ),
  369.             ),
  370.             'meta_date'                     => array(
  371.                 'label'            => esc_html__( 'Date Format', 'et_builder' ),
  372.                 'type'             => 'text',
  373.                 'option_category'  => 'configuration',
  374.                 'description'      => esc_html__( 'If you would like to adjust the date format, input the appropriate PHP date format here.', 'et_builder' ),
  375.                 'toggle_slug'      => 'main_content',
  376.                 'computed_affects' => array(
  377.                     '__posts',
  378.                 ),
  379.                 'default'          => 'M j, Y',
  380.             ),
  381.             'show_thumbnail'                => array(
  382.                 'label'            => esc_html__( 'Show Featured Image', 'et_builder' ),
  383.                 'type'             => 'yes_no_button',
  384.                 'option_category'  => 'configuration',
  385.                 'options'          => array(
  386.                     'on'  => et_builder_i18n( 'Yes' ),
  387.                     'off' => et_builder_i18n( 'No' ),
  388.                 ),
  389.                 'description'      => esc_html__( 'This will turn thumbnails on and off.', 'et_builder' ),
  390.                 'computed_affects' => array(
  391.                     '__posts',
  392.                 ),
  393.                 'toggle_slug'      => 'elements',
  394.                 'default_on_front' => 'on',
  395.                 'mobile_options'   => true,
  396.                 'hover'            => 'tabs',
  397.             ),
  398.             'show_content'                  => array(
  399.                 'label'            => esc_html__( 'Content Length', 'et_builder' ),
  400.                 'type'             => 'select',
  401.                 'option_category'  => 'configuration',
  402.                 'options'          => array(
  403.                     'off' => esc_html__( 'Show Excerpt', 'et_builder' ),
  404.                     'on'  => esc_html__( 'Show Content', 'et_builder' ),
  405.                 ),
  406.                 'affects'          => array(
  407.                     'show_more',
  408.                     'show_excerpt',
  409.                     'use_manual_excerpt',
  410.                     'excerpt_length',
  411.                 ),
  412.                 'description'      => esc_html__( 'Showing the full content will not truncate your posts on the index page. Showing the excerpt will only display your excerpt text.', 'et_builder' ),
  413.                 'toggle_slug'      => 'main_content',
  414.                 'computed_affects' => array(
  415.                     '__posts',
  416.                 ),
  417.                 'default_on_front' => 'off',
  418.                 'mobile_options'   => true,
  419.                 'hover'            => 'tabs',
  420.             ),
  421.             'use_manual_excerpt'            => array(
  422.                 'label'            => esc_html__( 'Use Post Excerpts', 'et_builder' ),
  423.                 'description'      => esc_html__( 'Disable this option if you want to ignore manually defined excerpts and always generate it automatically.', 'et_builder' ),
  424.                 'type'             => 'yes_no_button',
  425.                 'options'          => array(
  426.                     'on'  => et_builder_i18n( 'Yes' ),
  427.                     'off' => et_builder_i18n( 'No' ),
  428.                 ),
  429.                 'default'          => 'on',
  430.                 'computed_affects' => array(
  431.                     '__posts',
  432.                 ),
  433.                 'depends_show_if'  => 'off',
  434.                 'toggle_slug'      => 'main_content',
  435.                 'option_category'  => 'configuration',
  436.             ),
  437.             'excerpt_length'                => array(
  438.                 'label'            => esc_html__( 'Excerpt Length', 'et_builder' ),
  439.                 'description'      => esc_html__( 'Define the length of automatically generated excerpts. Leave blank for default ( 270 ) ', 'et_builder' ),
  440.                 'type'             => 'text',
  441.                 'default'          => '270',
  442.                 'computed_affects' => array(
  443.                     '__posts',
  444.                 ),
  445.                 'depends_show_if'  => 'off',
  446.                 'toggle_slug'      => 'main_content',
  447.                 'option_category'  => 'configuration',
  448.             ),
  449.             'show_more'                     => array(
  450.                 'label'            => esc_html__( 'Show Read More Button', 'et_builder' ),
  451.                 'type'             => 'yes_no_button',
  452.                 'option_category'  => 'configuration',
  453.                 'options'          => array(
  454.                     'off' => et_builder_i18n( 'No' ),
  455.                     'on'  => et_builder_i18n( 'Yes' ),
  456.                 ),
  457.                 'depends_show_if'  => 'off',
  458.                 'description'      => esc_html__( 'Here you can define whether to show "read more" link after the excerpts or not.', 'et_builder' ),
  459.                 'computed_affects' => array(
  460.                     '__posts',
  461.                 ),
  462.                 'toggle_slug'      => 'elements',
  463.                 'default_on_front' => 'off',
  464.                 'mobile_options'   => true,
  465.                 'hover'            => 'tabs',
  466.             ),
  467.             'show_author'                   => array(
  468.                 'label'            => esc_html__( 'Show Author', 'et_builder' ),
  469.                 'type'             => 'yes_no_button',
  470.                 'option_category'  => 'configuration',
  471.                 'options'          => array(
  472.                     'on'  => et_builder_i18n( 'Yes' ),
  473.                     'off' => et_builder_i18n( 'No' ),
  474.                 ),
  475.                 'description'      => esc_html__( 'Turn on or off the author link.', 'et_builder' ),
  476.                 'computed_affects' => array(
  477.                     '__posts',
  478.                 ),
  479.                 'toggle_slug'      => 'elements',
  480.                 'default_on_front' => 'on',
  481.                 'mobile_options'   => true,
  482.                 'hover'            => 'tabs',
  483.             ),
  484.             'show_date'                     => array(
  485.                 'label'            => esc_html__( 'Show Date', 'et_builder' ),
  486.                 'type'             => 'yes_no_button',
  487.                 'option_category'  => 'configuration',
  488.                 'options'          => array(
  489.                     'on'  => et_builder_i18n( 'Yes' ),
  490.                     'off' => et_builder_i18n( 'No' ),
  491.                 ),
  492.                 'description'      => esc_html__( 'Turn the date on or off.', 'et_builder' ),
  493.                 'computed_affects' => array(
  494.                     '__posts',
  495.                 ),
  496.                 'toggle_slug'      => 'elements',
  497.                 'default_on_front' => 'on',
  498.                 'mobile_options'   => true,
  499.                 'hover'            => 'tabs',
  500.             ),
  501.             'show_categories'               => array(
  502.                 'label'            => esc_html__( 'Show Categories', 'et_builder' ),
  503.                 'type'             => 'yes_no_button',
  504.                 'option_category'  => 'configuration',
  505.                 'options'          => array(
  506.                     'on'  => et_builder_i18n( 'Yes' ),
  507.                     'off' => et_builder_i18n( 'No' ),
  508.                 ),
  509.                 'description'      => esc_html__( 'Turn the category links on or off.', 'et_builder' ),
  510.                 'computed_affects' => array(
  511.                     '__posts',
  512.                 ),
  513.                 'toggle_slug'      => 'elements',
  514.                 'default_on_front' => 'on',
  515.                 'mobile_options'   => true,
  516.                 'hover'            => 'tabs',
  517.             ),
  518.             'show_comments'                 => array(
  519.                 'label'            => esc_html__( 'Show Comment Count', 'et_builder' ),
  520.                 'type'             => 'yes_no_button',
  521.                 'option_category'  => 'configuration',
  522.                 'options'          => array(
  523.                     'on'  => et_builder_i18n( 'Yes' ),
  524.                     'off' => et_builder_i18n( 'No' ),
  525.                 ),
  526.                 'description'      => esc_html__( 'Turn comment count on and off.', 'et_builder' ),
  527.                 'computed_affects' => array(
  528.                     '__posts',
  529.                 ),
  530.                 'toggle_slug'      => 'elements',
  531.                 'default_on_front' => 'off',
  532.                 'mobile_options'   => true,
  533.                 'hover'            => 'tabs',
  534.             ),
  535.             'show_excerpt'                  => array(
  536.                 'label'            => esc_html__( 'Show Excerpt', 'et_builder' ),
  537.                 'description'      => esc_html__( 'Turn excerpt on and off.', 'et_builder' ),
  538.                 'type'             => 'yes_no_button',
  539.                 'options'          => array(
  540.                     'on'  => et_builder_i18n( 'Yes' ),
  541.                     'off' => et_builder_i18n( 'No' ),
  542.                 ),
  543.                 'default_on_front' => 'on',
  544.                 'computed_affects' => array(
  545.                     '__posts',
  546.                 ),
  547.                 'depends_show_if'  => 'off',
  548.                 'toggle_slug'      => 'elements',
  549.                 'option_category'  => 'configuration',
  550.                 'mobile_options'   => true,
  551.                 'hover'            => 'tabs',
  552.             ),
  553.             'show_pagination'               => array(
  554.                 'label'            => esc_html__( 'Show Pagination', 'et_builder' ),
  555.                 'type'             => 'yes_no_button',
  556.                 'option_category'  => 'configuration',
  557.                 'options'          => array(
  558.                     'on'  => et_builder_i18n( 'Yes' ),
  559.                     'off' => et_builder_i18n( 'No' ),
  560.                 ),
  561.                 'description'      => esc_html__( 'Turn pagination on and off.', 'et_builder' ),
  562.                 'computed_affects' => array(
  563.                     '__posts',
  564.                 ),
  565.                 'toggle_slug'      => 'elements',
  566.                 'default_on_front' => 'on',
  567.                 'mobile_options'   => true,
  568.                 'hover'            => 'tabs',
  569.             ),
  570.             'offset_number'                 => array(
  571.                 'label'            => esc_html__( 'Post Offset Number', 'et_builder' ),
  572.                 'type'             => 'text',
  573.                 'option_category'  => 'configuration',
  574.                 'description'      => esc_html__( 'Choose how many posts you would like to skip. These posts will not be shown in the feed.', 'et_builder' ),
  575.                 'toggle_slug'      => 'main_content',
  576.                 'computed_affects' => array(
  577.                     '__posts',
  578.                 ),
  579.                 'default'          => 0,
  580.             ),
  581.             'use_overlay'                   => array(
  582.                 'label'            => esc_html__( 'Featured Image Overlay', 'et_builder' ),
  583.                 'type'             => 'yes_no_button',
  584.                 'option_category'  => 'layout',
  585.                 'options'          => array(
  586.                     'off' => et_builder_i18n( 'Off' ),
  587.                     'on'  => et_builder_i18n( 'On' ),
  588.                 ),
  589.                 'affects'          => array(
  590.                     'overlay_icon_color',
  591.                     'hover_overlay_color',
  592.                     'hover_icon',
  593.                 ),
  594.                 'description'      => esc_html__( 'If enabled, an overlay color and icon will be displayed when a visitors hovers over the featured image of a post.', 'et_builder' ),
  595.                 'computed_affects' => array(
  596.                     '__posts',
  597.                 ),
  598.                 'tab_slug'         => 'advanced',
  599.                 'toggle_slug'      => 'overlay',
  600.                 'default_on_front' => 'off',
  601.             ),
  602.             'overlay_icon_color'            => array(
  603.                 'label'           => esc_html__( 'Overlay Icon Color', 'et_builder' ),
  604.                 'type'            => 'color-alpha',
  605.                 'custom_color'    => true,
  606.                 'depends_show_if' => 'on',
  607.                 'tab_slug'        => 'advanced',
  608.                 'toggle_slug'     => 'overlay',
  609.                 'description'     => esc_html__( 'Here you can define a custom color for the overlay icon', 'et_builder' ),
  610.                 'mobile_options'  => true,
  611.                 'sticky'          => true,
  612.             ),
  613.             'hover_overlay_color'           => array(
  614.                 'label'           => esc_html__( 'Overlay Background Color', 'et_builder' ),
  615.                 'type'            => 'color-alpha',
  616.                 'custom_color'    => true,
  617.                 'depends_show_if' => 'on',
  618.                 'tab_slug'        => 'advanced',
  619.                 'toggle_slug'     => 'overlay',
  620.                 'description'     => esc_html__( 'Here you can define a custom color for the overlay', 'et_builder' ),
  621.                 'mobile_options'  => true,
  622.                 'sticky'          => true,
  623.             ),
  624.             'hover_icon'                    => array(
  625.                 'label'            => esc_html__( 'Overlay Icon', 'et_builder' ),
  626.                 'type'             => 'select_icon',
  627.                 'option_category'  => 'configuration',
  628.                 'class'            => array( 'et-pb-font-icon' ),
  629.                 'depends_show_if'  => 'on',
  630.                 'description'      => esc_html__( 'Here you can define a custom icon for the overlay', 'et_builder' ),
  631.                 'tab_slug'         => 'advanced',
  632.                 'toggle_slug'      => 'overlay',
  633.                 'computed_affects' => array(
  634.                     '__posts',
  635.                 ),
  636.                 'mobile_options'   => true,
  637.                 'sticky'           => true,
  638.             ),
  639.             'masonry_tile_background_color' => array(
  640.                 'label'           => esc_html__( 'Grid Tile Background Color', 'et_builder' ),
  641.                 'type'            => 'color-alpha',
  642.                 'custom_color'    => true,
  643.                 'toggle_slug'     => 'background',
  644.                 'depends_show_if' => 'off',
  645.                 'depends_on'      => array(
  646.                     'fullwidth',
  647.                 ),
  648.                 'hover'           => 'tabs',
  649.                 'mobile_options'  => true,
  650.                 'sticky'          => true,
  651.             ),
  652.             '__posts'                       => array(
  653.                 'type'                => 'computed',
  654.                 'computed_callback'   => array( 'ET_Builder_Module_Blog', 'get_blog_posts' ),
  655.                 'computed_depends_on' => array(
  656.                     'use_current_loop',
  657.                     'post_type',
  658.                     'fullwidth',
  659.                     'posts_number',
  660.                     'include_categories',
  661.                     'meta_date',
  662.                     'show_thumbnail',
  663.                     'show_content',
  664.                     'show_more',
  665.                     'show_author',
  666.                     'show_date',
  667.                     'show_categories',
  668.                     'show_comments',
  669.                     'show_excerpt',
  670.                     'use_manual_excerpt',
  671.                     'excerpt_length',
  672.                     'show_pagination',
  673.                     'offset_number',
  674.                     'use_overlay',
  675.                     'hover_icon',
  676.                     'hover_icon_tablet',
  677.                     'hover_icon_phone',
  678.                     'header_level',
  679.                     '__page',
  680.                 ),
  681.             ),
  682.             '__page'                        => array(
  683.                 'type'              => 'computed',
  684.                 'computed_callback' => array( 'ET_Builder_Module_Blog', 'get_blog_posts' ),
  685.                 'computed_affects'  => array(
  686.                     '__posts',
  687.                 ),
  688.             ),
  689.         );
  690.         return $fields;
  691.     }
  692.  
  693.     public function get_transition_fields_css_props() {
  694.         $fields = parent::get_transition_fields_css_props();
  695.  
  696.         $fields['background_layout']             = array(
  697.             'color' => implode(
  698.                 ', ',
  699.                 array(
  700.                     '%%order_class%% .entry-title',
  701.                     '%%order_class%% .post-meta',
  702.                     '%%order_class%% .post-content',
  703.                 )
  704.             ),
  705.         );
  706.         $fields['border_radii']                  = array( 'border-radius' => self::$_->array_get( $this->advanced_fields, 'borders.default.css.main.border_radii' ) );
  707.         $fields['border_styles']                 = array( 'border' => self::$_->array_get( $this->advanced_fields, 'borders.default.css.main.border_styles' ) );
  708.         $fields['border_radii_fullwidth']        = array( 'border-radius' => self::$_->array_get( $this->advanced_fields, 'borders.fullwidth.css.main.border_radii' ) );
  709.         $fields['border_styles_fullwidth']       = array( 'border' => self::$_->array_get( $this->advanced_fields, 'borders.fullwidth.css.main.border_styles' ) );
  710.         $fields['max_width']                     = array( 'max-width' => '%%order_class%%' );
  711.         $fields['width']                         = array( 'width' => '%%order_class%%' );
  712.         $fields['overlay_icon_color']            = array( 'background-color' => '%%order_class%% .et_overlay:before' );
  713.         $fields['hover_overlay_color']           = array( 'background-color' => '%%order_class%% .et_overlay' );
  714.         $fields['masonry_tile_background_color'] = array( 'background-color' => '%%order_class%% .et_pb_blog_grid .et_pb_post' );
  715.  
  716.         return $fields;
  717.     }
  718.  
  719.     /**
  720.      * Get blog posts for blog module
  721.      *
  722.      * @param array   arguments that is being used by et_pb_blog
  723.      * @return string blog post markup
  724.      */
  725.     static function get_blog_posts( $args = array(), $conditional_tags = array(), $current_page = array() ) {
  726.         global $paged, $post, $wp_query, $et_fb_processing_shortcode_object, $et_pb_rendering_column_content;
  727.  
  728.         if ( self::$rendering ) {
  729.             // We are trying to render a Blog module while a Blog module is already being rendered
  730.             // which means we have most probably hit an infinite recursion. While not necessarily
  731.             // the case, rendering a post which renders a Blog module which renders a post
  732.             // which renders a Blog module is not a sensible use-case.
  733.             return '';
  734.         }
  735.  
  736.         $global_processing_original_value = $et_fb_processing_shortcode_object;
  737.  
  738.         // Default params are combination of attributes that is used by et_pb_blog and
  739.         // conditional tags that need to be simulated (due to AJAX nature) by passing args
  740.         $defaults = array(
  741.             'use_current_loop'              => 'off',
  742.             'post_type'                     => '',
  743.             'fullwidth'                     => '',
  744.             'posts_number'                  => '',
  745.             'include_categories'            => '',
  746.             'meta_date'                     => '',
  747.             'show_thumbnail'                => '',
  748.             'show_content'                  => '',
  749.             'show_author'                   => '',
  750.             'show_date'                     => '',
  751.             'show_categories'               => '',
  752.             'show_comments'                 => '',
  753.             'show_excerpt'                  => '',
  754.             'use_manual_excerpt'            => '',
  755.             'excerpt_length'                => '',
  756.             'show_pagination'               => '',
  757.             'background_layout'             => '',
  758.             'show_more'                     => '',
  759.             'offset_number'                 => '',
  760.             'masonry_tile_background_color' => '',
  761.             'overlay_icon_color'            => '',
  762.             'hover_overlay_color'           => '',
  763.             'hover_icon'                    => '',
  764.             'hover_icon_tablet'             => '',
  765.             'hover_icon_phone'              => '',
  766.             'use_overlay'                   => '',
  767.             'header_level'                  => 'h2',
  768.         );
  769.  
  770.         // WordPress' native conditional tag is only available during page load. It'll fail during component update because
  771.         // et_pb_process_computed_property() is loaded in admin-ajax.php. Thus, use WordPress' conditional tags on page load and
  772.         // rely to passed $conditional_tags for AJAX call
  773.         $is_front_page               = et_fb_conditional_tag( 'is_front_page', $conditional_tags );
  774.         $is_single                   = et_fb_conditional_tag( 'is_single', $conditional_tags );
  775.         $et_is_builder_plugin_active = et_fb_conditional_tag( 'et_is_builder_plugin_active', $conditional_tags );
  776.         $post_id                     = isset( $current_page['id'] ) ? (int) $current_page['id'] : 0;
  777.  
  778.         $container_is_closed = false;
  779.  
  780.         // remove all filters from WP audio shortcode to make sure current theme doesn't add any elements into audio module
  781.         remove_all_filters( 'wp_audio_shortcode_library' );
  782.         remove_all_filters( 'wp_audio_shortcode' );
  783.         remove_all_filters( 'wp_audio_shortcode_class' );
  784.  
  785.         $args = wp_parse_args( $args, $defaults );
  786.  
  787.         if ( 'on' === $args['use_current_loop'] ) {
  788.             // Reset loop-affecting values to their defaults to simulate the current loop.
  789.             $reset_keys = array( 'post_type', 'include_categories' );
  790.  
  791.             foreach ( $reset_keys as $key ) {
  792.                 $args[ $key ] = $defaults[ $key ];
  793.             }
  794.         }
  795.  
  796.         $processed_header_level = et_pb_process_header_level( $args['header_level'], 'h2' );
  797.         $processed_header_level = esc_html( $processed_header_level );
  798.  
  799.         $overlay_output = '';
  800.  
  801.         if ( 'on' === $args['use_overlay'] ) {
  802.             $overlay_output = ET_Builder_Module_Helper_Overlay::render(
  803.                 array(
  804.                     'icon'        => $args['hover_icon'],
  805.                     'icon_tablet' => $args['hover_icon_tablet'],
  806.                     'icon_phone'  => $args['hover_icon_phone'],
  807.                 )
  808.             );
  809.         }
  810.  
  811.         $overlay_class = 'on' === $args['use_overlay'] ? ' et_pb_has_overlay' : '';
  812.  
  813.         $query_args = array(
  814.             'posts_per_page' => intval( $args['posts_number'] ),
  815.             'post_status'    => array( 'publish', 'private', 'inherit' ),
  816.             'perm'           => 'readable',
  817.             'post_type'      => $args['post_type'],
  818.         );
  819.  
  820.         if ( defined( 'DOING_AJAX' ) && isset( $current_page['paged'] ) ) {
  821.             $paged = intval( $current_page['paged'] ); //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  822.         } else {
  823.             $paged = $is_front_page ? get_query_var( 'page' ) : get_query_var( 'paged' ); //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  824.         }
  825.  
  826.         // support pagination in VB
  827.         if ( isset( $args['__page'] ) ) {
  828.             $paged = $args['__page']; //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  829.         }
  830.  
  831.         $query_args['cat'] = implode( ',', self::filter_include_categories( $args['include_categories'], $post_id ) );
  832.  
  833.         $query_args['paged'] = $paged;
  834.  
  835.         // WP_Query doesn't return sticky posts when it performed via Ajax.
  836.         // This happens because `is_home` is false in this case, but on FE it's true if no category set for the query.
  837.         // Set `is_home` = true to emulate the FE behavior with sticky posts in VB.
  838.         if ( empty( $query_args['cat'] ) ) {
  839.             add_action(
  840.                 'pre_get_posts',
  841.                 function( $query ) {
  842.                     if ( true === $query->get( 'et_is_home' ) ) {
  843.                         $query->is_home = true;
  844.                     }
  845.                 }
  846.             );
  847.  
  848.             $query_args['et_is_home'] = true;
  849.         }
  850.  
  851.         if ( '' !== $args['offset_number'] && ! empty( $args['offset_number'] ) ) {
  852.             /**
  853.              * Offset + pagination don't play well. Manual offset calculation required
  854.              *
  855.              * @see: https://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination
  856.              */
  857.             if ( $paged > 1 ) {
  858.                 $query_args['offset'] = ( ( $paged - 1 ) * intval( $args['posts_number'] ) ) + intval( $args['offset_number'] );
  859.             } else {
  860.                 $query_args['offset'] = intval( $args['offset_number'] );
  861.             }
  862.         }
  863.  
  864.         if ( $is_single ) {
  865.             $main_query_post = ET_Post_Stack::get_main_post();
  866.  
  867.             if ( null !== $main_query_post ) {
  868.                 $query_args['post__not_in'][] = $main_query_post->ID;
  869.             }
  870.         }
  871.  
  872.         // Get query
  873.         $query = new WP_Query( $query_args );
  874.  
  875.         /**
  876.          * Filters Blog module's main query.
  877.          *
  878.          * @since 4.7.0
  879.          * @since 4.11.0 Pass modified module attributes.
  880.          *
  881.          * @param WP_Query $query
  882.          * @param array    $args  Modified module attributes.
  883.          */
  884.         $query = apply_filters( 'et_builder_blog_query', $query, $args ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- We intend to override $wp_query for blog module.
  885.  
  886.         // Keep page's $wp_query global
  887.         $wp_query_page = $wp_query;
  888.  
  889.         // Turn page's $wp_query into this module's query
  890.         $wp_query = $query; //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  891.  
  892.         $wp_query->et_pb_blog_query = true;
  893.  
  894.         self::$rendering = true;
  895.  
  896.         // Manually set the max_num_pages to make the `next_posts_link` work
  897.         if ( '' !== $args['offset_number'] && ! empty( $args['offset_number'] ) ) {
  898.             $wp_query->found_posts   = max( 0, $wp_query->found_posts - intval( $args['offset_number'] ) );
  899.             $posts_number            = intval( $args['posts_number'] );
  900.             $wp_query->max_num_pages = $posts_number > 1 ? ceil( $wp_query->found_posts / $posts_number ) : 1;
  901.         }
  902.  
  903.         ob_start();
  904.  
  905.         if ( $query->have_posts() ) {
  906.             if ( 'on' !== $args['fullwidth'] ) {
  907.                 echo '<div class="et_pb_salvattore_content" data-columns>';
  908.             }
  909.  
  910.             while ( $query->have_posts() ) {
  911.                 $query->the_post();
  912.                 ET_Post_Stack::replace( $post );
  913.                 global $et_fb_processing_shortcode_object;
  914.  
  915.                 $global_processing_original_value = $et_fb_processing_shortcode_object;
  916.  
  917.                 // reset the fb processing flag
  918.                 $et_fb_processing_shortcode_object = false;
  919.  
  920.                 $thumb          = '';
  921.                 $width          = 'on' === $args['fullwidth'] ? 1080 : 400;
  922.                 $width          = (int) apply_filters( 'et_pb_blog_image_width', $width );
  923.                 $height         = 'on' === $args['fullwidth'] ? 675 : 250;
  924.                 $height         = (int) apply_filters( 'et_pb_blog_image_height', $height );
  925.                 $classtext      = 'on' === $args['fullwidth'] ? 'et_pb_post_main_image' : '';
  926.                 $titletext      = get_the_title();
  927.                 $alttext        = get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true );
  928.                 $thumbnail      = get_thumbnail( $width, $height, $classtext, $alttext, $titletext, false, 'Blogimage' );
  929.                 $thumb          = $thumbnail['thumb'];
  930.                 $no_thumb_class = '' === $thumb || 'off' === $args['show_thumbnail'] ? ' et_pb_no_thumb' : '';
  931.                 $excerpt_length = '' !== $args['excerpt_length'] ? intval( $args['excerpt_length'] ) : 270;
  932.  
  933.                 $post_format = et_pb_post_format();
  934.                 if ( in_array( $post_format, array( 'video', 'gallery' ) ) ) {
  935.                     $no_thumb_class = '';
  936.                 }
  937.  
  938.                 // Print output
  939.                 ?>
  940.                     <article id="" <?php post_class( 'et_pb_post clearfix' . $no_thumb_class . $overlay_class ); ?>>
  941.                         <?php
  942.                             et_divi_post_format_content();
  943.  
  944.                         if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) {
  945.                             if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) :
  946.                                 $video_overlay = has_post_thumbnail() ? sprintf(
  947.                                     '<div class="et_pb_video_overlay" style="background-image: url(%1$s); background-size: cover;">
  948.                                             <div class="et_pb_video_overlay_hover">
  949.                                                 <a href="#" class="et_pb_video_play"></a>
  950.                                             </div>
  951.                                         </div>',
  952.                                     et_core_esc_previously( $thumb )
  953.                                 ) : '';
  954.  
  955.                                 printf(
  956.                                     '<div class="et_main_video_container">
  957.                                             %1$s
  958.                                             %2$s
  959.                                         </div>',
  960.                                     et_core_esc_previously( $video_overlay ),
  961.                                     et_core_esc_previously( $first_video )
  962.                                 );
  963.                             elseif ( 'gallery' === $post_format ) :
  964.                                 et_pb_gallery_images( 'slider' );
  965.                                 elseif ( '' !== $thumb && 'on' === $args['show_thumbnail'] ) :
  966.                                     if ( 'on' !== $args['fullwidth'] ) {
  967.                                         echo '<div class="et_pb_image_container">';
  968.                                     }
  969.                                     ?>
  970.                                         <a href="<?php esc_url( the_permalink() ); ?>" class="entry-featured-image-url">
  971.                                             <?php print_thumbnail( $thumb, $thumbnail['use_timthumb'], $titletext, $width, $height ); ?>
  972.                                             <?php
  973.                                             if ( 'on' === $args['use_overlay'] ) {
  974.                                                 echo et_core_esc_previously( $overlay_output );
  975.                                             }
  976.                                             ?>
  977.                                         </a>
  978.                                     <?php
  979.                                     if ( 'on' !== $args['fullwidth'] ) {
  980.                                         echo '</div>';
  981.                                     }
  982.                                 endif;
  983.                         }
  984.                         ?>
  985.  
  986.                         <?php if ( 'off' === $args['fullwidth'] || ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) { ?>
  987.                             <?php if ( ! in_array( $post_format, array( 'link', 'audio' ) ) ) { ?>
  988.                                 <<?php echo et_core_esc_previously( $processed_header_level ); ?> class="entry-title"><a href="<?php esc_url( the_permalink() ); ?>"><?php the_title(); ?></a></<?php echo et_core_esc_previously( $processed_header_level ); ?>>
  989.                             <?php } ?>
  990.  
  991.                             <?php
  992.                             if ( 'on' === $args['show_author'] || 'on' === $args['show_date'] || 'on' === $args['show_categories'] || 'on' === $args['show_comments'] ) {
  993.                                 $author = 'on' === $args['show_author']
  994.                                     ? et_get_safe_localization( sprintf( __( 'by %s', 'et_builder' ), '<span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>' ) )
  995.                                     : '';
  996.  
  997.                                 $author_separator = 'on' === $args['show_author'] && 'on' === $args['show_date']
  998.                                     ? ' | '
  999.                                     : '';
  1000.  
  1001.                                 // phpcs:disable WordPress.WP.I18n.NoEmptyStrings -- intentionally used.
  1002.                                 $date = 'on' === $args['show_date']
  1003.                                     ? et_get_safe_localization( sprintf( __( '%s', 'et_builder' ), '<span class="published">' . esc_html( get_the_date( str_replace( '\\\\', '\\', $args['meta_date'] ) ) ) . '</span>' ) )
  1004.                                     : '';
  1005.                                 // phpcs:enable
  1006.  
  1007.                                 $date_separator = ( ( 'on' === $args['show_author'] || 'on' === $args['show_date'] ) && 'on' === $args['show_categories'] )
  1008.                                     ? ' | '
  1009.                                     : '';
  1010.  
  1011.                                 $categories = 'on' === $args['show_categories']
  1012.                                     ? et_builder_get_the_term_list( ', ' )
  1013.                                     : '';
  1014.  
  1015.                                 $categories_separator = ( ( 'on' === $args['show_author'] || 'on' === $args['show_date'] || 'on' === $args['show_categories'] ) && 'on' === $args['show_comments'] )
  1016.                                     ? ' | '
  1017.                                     : '';
  1018.  
  1019.                                 $comments = 'on' === $args['show_comments']
  1020.                                     ? et_core_maybe_convert_to_utf_8( sprintf( esc_html( _nx( '%s Comment', '%s Comments', get_comments_number(), 'number of comments', 'et_builder' ) ), number_format_i18n( get_comments_number() ) ) )
  1021.                                     : '';
  1022.  
  1023.                                 printf(
  1024.                                     '<p class="post-meta">%1$s %2$s %3$s %4$s %5$s %6$s %7$s</p>',
  1025.                                     et_core_esc_previously( $author ),
  1026.                                     et_core_intentionally_unescaped( $author_separator, 'fixed_string' ),
  1027.                                     et_core_esc_previously( $date ),
  1028.                                     et_core_intentionally_unescaped( $date_separator, 'fixed_string' ),
  1029.                                     et_core_esc_wp( $categories ),
  1030.                                     et_core_intentionally_unescaped( $categories_separator, 'fixed_string' ),
  1031.                                     et_core_esc_previously( $comments )
  1032.                                 );
  1033.                             }
  1034.  
  1035.                                 $post_content = et_strip_shortcodes( et_delete_post_first_video( get_the_content() ), true );
  1036.  
  1037.                                 // reset the fb processing flag
  1038.                                 $et_fb_processing_shortcode_object = false;
  1039.                                 // set the flag to indicate that we're processing internal content
  1040.                                 $et_pb_rendering_column_content = true;
  1041.                                 // reset all the attributes required to properly generate the internal styles
  1042.                                 ET_Builder_Element::clean_internal_modules_styles();
  1043.  
  1044.                                 echo '<div class="post-content">';
  1045.  
  1046.                             if ( 'on' === $args['show_content'] ) {
  1047.                                 global $more;
  1048.  
  1049.                                 // page builder doesn't support more tag, so display the_content() in case of post made with page builder
  1050.                                 if ( et_pb_is_pagebuilder_used( get_the_ID() ) ) {
  1051.                                     $more = 1; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1052.  
  1053.                                     echo et_core_intentionally_unescaped( apply_filters( 'the_content', $post_content ), 'html' );
  1054.  
  1055.                                 } else {
  1056.                                     $more = null; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1057.                                     echo et_core_intentionally_unescaped( apply_filters( 'the_content', et_delete_post_first_video( get_the_content( esc_html__( 'read more...', 'et_builder' ) ) ) ), 'html' );
  1058.                                 }
  1059.                             } elseif ( 'on' === $args['show_excerpt'] ) {
  1060.                                 if ( has_excerpt() && 'off' !== $args['use_manual_excerpt'] ) {
  1061.                                     the_excerpt();
  1062.                                 } else {
  1063.                                     if ( '' !== $post_content ) {
  1064.                                         // set the $et_fb_processing_shortcode_object to false, to retrieve the content inside truncate_post() correctly
  1065.                                         $et_fb_processing_shortcode_object = false;
  1066.                                         echo et_core_intentionally_unescaped( wpautop( et_delete_post_first_video( strip_shortcodes( truncate_post( $excerpt_length, false, '', true ) ) ) ), 'html' );
  1067.                                         // reset the $et_fb_processing_shortcode_object to its original value
  1068.                                         $et_fb_processing_shortcode_object = $global_processing_original_value;
  1069.                                     } else {
  1070.                                         echo '';
  1071.                                     }
  1072.                                 }
  1073.                             }
  1074.  
  1075.                                 $et_fb_processing_shortcode_object = $global_processing_original_value;
  1076.                                 // retrieve the styles for the modules inside Blog content
  1077.                                 $internal_style = ET_Builder_Element::get_style( true );
  1078.                                 // reset all the attributes after we retrieved styles
  1079.                                 ET_Builder_Element::clean_internal_modules_styles( false );
  1080.                                 $et_pb_rendering_column_content = false;
  1081.                                 // append styles to the blog content
  1082.                             if ( $internal_style ) {
  1083.                                 printf(
  1084.                                     '<style type="text/css" class="et_fb_blog_inner_content_styles">
  1085.                                             %1$s
  1086.                                         </style>',
  1087.                                     et_core_esc_previously( $internal_style )
  1088.                                 );
  1089.                             }
  1090.  
  1091.                             if ( 'on' !== $args['show_content'] ) {
  1092.                                 $more = 'on' === $args['show_more'] ? sprintf( ' <a href="%1$s" class="more-link" >%2$s</a>', esc_url( get_permalink() ), esc_html__( 'read more', 'et_builder' ) ) : ''; //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1093.                                 echo et_core_esc_previously( $more );
  1094.                             }
  1095.  
  1096.                                 echo '</div>';
  1097.                             ?>
  1098.                         <?php } // 'off' === $fullwidth || ! in_array( $post_format, array( 'link', 'audio', 'quote', 'gallery' ?>
  1099.                     </article>
  1100.                 <?php
  1101.  
  1102.                 $et_fb_processing_shortcode_object = $global_processing_original_value;
  1103.                 ET_Post_Stack::pop();
  1104.             } // endwhile
  1105.             ET_Post_Stack::reset();
  1106.  
  1107.             if ( 'on' !== $args['fullwidth'] ) {
  1108.                 echo '</div>';
  1109.             }
  1110.  
  1111.             if ( 'on' === $args['show_pagination'] ) {
  1112.  
  1113.                 $container_is_closed = true;
  1114.  
  1115.                 if ( function_exists( 'wp_pagenavi' ) ) {
  1116.                     wp_pagenavi(
  1117.                         array(
  1118.                             'query' => $query,
  1119.                         )
  1120.                     );
  1121.                 } else {
  1122.                     if ( $et_is_builder_plugin_active ) {
  1123.                         include ET_BUILDER_PLUGIN_DIR . 'includes/navigation.php';
  1124.                     } else {
  1125.                         get_template_part( 'includes/navigation', 'index' );
  1126.                     }
  1127.                 }
  1128.             }
  1129.         }
  1130.  
  1131.         unset( $wp_query->et_pb_blog_query );
  1132.  
  1133.         // Reset $wp_query to its origin
  1134.         $wp_query = $wp_query_page; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1135.  
  1136.         if ( ! $posts = ob_get_clean() ) {
  1137.             $posts = self::get_no_results_template( et_core_esc_previously( $processed_header_level ) );
  1138.         }
  1139.  
  1140.         self::$rendering = false;
  1141.  
  1142.         return $posts;
  1143.     }
  1144.  
  1145.     /**
  1146.      * Render pagination element
  1147.      *
  1148.      * @since 3.27.1
  1149.      *
  1150.      * @param bool $echo Wether to print the output or return it.
  1151.      *
  1152.      * @return (void|string)
  1153.      */
  1154.     function render_pagination( $echo = true ) {
  1155.         if ( ! $echo ) {
  1156.             ob_start();
  1157.         }
  1158.  
  1159.         add_filter( 'get_pagenum_link', array( 'ET_Builder_Module_Blog', 'filter_pagination_url' ) );
  1160.  
  1161.         if ( function_exists( 'wp_pagenavi' ) ) {
  1162.             wp_pagenavi();
  1163.         } else {
  1164.             if ( et_is_builder_plugin_active() ) {
  1165.                 include ET_BUILDER_PLUGIN_DIR . 'includes/navigation.php';
  1166.             } else {
  1167.                 get_template_part( 'includes/navigation', 'index' );
  1168.             }
  1169.         }
  1170.  
  1171.         remove_filter( 'get_pagenum_link', array( 'ET_Builder_Module_Blog', 'filter_pagination_url' ) );
  1172.  
  1173.         if ( ! $echo ) {
  1174.             $output = ob_get_contents();
  1175.             ob_end_clean();
  1176.  
  1177.             return $output;
  1178.         }
  1179.     }
  1180.  
  1181.     /**
  1182.      * Filter the pagination url to add a flag so it can be filtered to avoid pagination clashes with the main query.
  1183.      *
  1184.      * @since 4.0
  1185.      *
  1186.      * @param string  $result
  1187.      * @param integer $pagenum
  1188.      *
  1189.      * @return string
  1190.      */
  1191.     public static function filter_pagination_url( $result ) {
  1192.         return add_query_arg( 'et_blog', '', $result );
  1193.     }
  1194.  
  1195.     /**
  1196.      * Renders the module output.
  1197.      *
  1198.      * @param  array  $attrs       List of attributes.
  1199.      * @param  string $content     Content being processed.
  1200.      * @param  string $render_slug Slug of module that is used for rendering output.
  1201.      *
  1202.      * @return string
  1203.      */
  1204.     public function render( $attrs, $content, $render_slug ) {
  1205.         global $post, $paged, $wp_query, $wp_the_query, $wp_filter, $__et_blog_module_paged;
  1206.  
  1207.         if ( self::$rendering ) {
  1208.             // We are trying to render a Blog module while a Blog module is already being rendered
  1209.             // which means we have most probably hit an infinite recursion. While not necessarily
  1210.             // the case, rendering a post which renders a Blog module which renders a post
  1211.             // which renders a Blog module is not a sensible use-case.
  1212.             return '';
  1213.         }
  1214.  
  1215.         // Keep a reference to the real main query to restore from later.
  1216.         $main_query = $wp_the_query;
  1217.  
  1218.         // Stored current global post as variable so global $post variable can be restored
  1219.         // to its original state when et_pb_blog shortcode ends to avoid incorrect global $post
  1220.         // being used on the page (i.e. blog + shop module in backend builder)
  1221.         $post_cache = $post;
  1222.  
  1223.         /**
  1224.          * Cached $wp_filter so it can be restored at the end of the callback.
  1225.          * This is needed because this callback uses the_content filter / calls a function
  1226.          * which uses the_content filter. WordPress doesn't support nested filter
  1227.          */
  1228.         $wp_filter_cache = $wp_filter;
  1229.  
  1230.         // Helpers.
  1231.         $sticky = et_pb_sticky_options();
  1232.  
  1233.         $multi_view         = et_pb_multi_view_options( $this );
  1234.         $use_current_loop   = isset( $this->props['use_current_loop'] ) ? $this->props['use_current_loop'] : 'off';
  1235.         $post_type          = isset( $this->props['post_type'] ) ? $this->props['post_type'] : 'post';
  1236.         $fullwidth          = $this->props['fullwidth'];
  1237.         $posts_number       = $this->props['posts_number'];
  1238.         $include_categories = $this->props['include_categories'];
  1239.         $meta_date          = $this->props['meta_date'];
  1240.         $show_thumbnail     = $this->props['show_thumbnail'];
  1241.         $show_content       = $this->props['show_content'];
  1242.         $show_author        = $this->props['show_author'];
  1243.         $show_date          = $this->props['show_date'];
  1244.         $show_categories    = $this->props['show_categories'];
  1245.         $show_comments      = $this->props['show_comments'];
  1246.         $show_excerpt       = $this->props['show_excerpt'];
  1247.         $use_manual_excerpt = $this->props['use_manual_excerpt'];
  1248.         $excerpt_length     = $this->props['excerpt_length'];
  1249.         $show_pagination    = $this->props['show_pagination'];
  1250.         $show_more          = $this->props['show_more'];
  1251.         $offset_number      = $this->props['offset_number'];
  1252.         $use_overlay        = $this->props['use_overlay'];
  1253.         $header_level       = $this->props['header_level'];
  1254.  
  1255.         $background_layout               = $this->props['background_layout'];
  1256.         $background_layout_hover         = et_pb_hover_options()->get_value( 'background_layout', $this->props, 'light' );
  1257.         $background_layout_hover_enabled = et_pb_hover_options()->is_enabled( 'background_layout', $this->props );
  1258.         $background_layout_values        = et_pb_responsive_options()->get_property_values( $this->props, 'background_layout' );
  1259.         $background_layout_tablet        = isset( $background_layout_values['tablet'] ) ? $background_layout_values['tablet'] : '';
  1260.         $background_layout_phone         = isset( $background_layout_values['phone'] ) ? $background_layout_values['phone'] : '';
  1261.  
  1262.         $hover_icon        = $this->props['hover_icon'];
  1263.         $hover_icon_values = et_pb_responsive_options()->get_property_values( $this->props, 'hover_icon' );
  1264.         $hover_icon_tablet = isset( $hover_icon_values['tablet'] ) ? $hover_icon_values['tablet'] : '';
  1265.         $hover_icon_phone  = isset( $hover_icon_values['phone'] ) ? $hover_icon_values['phone'] : '';
  1266.         $hover_icon_sticky = $sticky->get_value( 'hover_icon', $this->props );
  1267.  
  1268.         $video_background          = $this->video_background();
  1269.         $parallax_image_background = $this->get_parallax_image_background();
  1270.  
  1271.         $container_is_closed = false;
  1272.  
  1273.         $processed_header_level = et_pb_process_header_level( $header_level, 'h2' );
  1274.  
  1275.         // some themes do not include these styles/scripts so we need to enqueue them in this module to support audio post format
  1276.         wp_enqueue_style( 'wp-mediaelement' );
  1277.         wp_enqueue_script( 'wp-mediaelement' );
  1278.  
  1279.         // remove all filters from WP audio shortcode to make sure current theme doesn't add any elements into audio module
  1280.         remove_all_filters( 'wp_audio_shortcode_library' );
  1281.         remove_all_filters( 'wp_audio_shortcode' );
  1282.         remove_all_filters( 'wp_audio_shortcode_class' );
  1283.  
  1284.         // Masonry Tile Background color.
  1285.         $this->generate_styles(
  1286.             array(
  1287.                 'base_attr_name' => 'masonry_tile_background_color',
  1288.                 'selector'       => '%%order_class%% .et_pb_blog_grid .et_pb_post',
  1289.                 'css_property'   => 'background-color',
  1290.                 'render_slug'    => $render_slug,
  1291.                 'type'           => 'color',
  1292.             )
  1293.         );
  1294.  
  1295.         // Overlay Icon Color.
  1296.         $this->generate_styles(
  1297.             array(
  1298.                 'hover'          => false,
  1299.                 'base_attr_name' => 'overlay_icon_color',
  1300.                 'selector'       => '%%order_class%% .et_overlay:before',
  1301.                 'css_property'   => 'color',
  1302.                 'render_slug'    => $render_slug,
  1303.                 'type'           => 'color',
  1304.             )
  1305.         );
  1306.  
  1307.         // Hover Overlay Color.
  1308.         $this->generate_styles(
  1309.             array(
  1310.                 'hover'          => false,
  1311.                 'base_attr_name' => 'hover_overlay_color',
  1312.                 'selector'       => '%%order_class%% .et_overlay',
  1313.                 'css_property'   => 'background-color',
  1314.                 'render_slug'    => $render_slug,
  1315.                 'type'           => 'color',
  1316.             )
  1317.         );
  1318.  
  1319.         $overlay_output = '';
  1320.  
  1321.         if ( 'on' === $use_overlay ) {
  1322.             $overlay_output = ET_Builder_Module_Helper_Overlay::render(
  1323.                 array(
  1324.                     'icon'        => $hover_icon,
  1325.                     'icon_tablet' => $hover_icon_tablet,
  1326.                     'icon_phone'  => $hover_icon_phone,
  1327.                     'icon_sticky' => $hover_icon_sticky,
  1328.                 )
  1329.             );
  1330.  
  1331.             // Overlay Icon Styles.
  1332.             $this->generate_styles(
  1333.                 array(
  1334.                     'hover'          => false,
  1335.                     'utility_arg'    => 'icon_font_family',
  1336.                     'render_slug'    => $render_slug,
  1337.                     'base_attr_name' => 'hover_icon',
  1338.                     'important'      => true,
  1339.                     'selector'       => '%%order_class%% .et_overlay:before',
  1340.                     'processor'      => array(
  1341.                         'ET_Builder_Module_Helper_Style_Processor',
  1342.                         'process_extended_icon',
  1343.                     ),
  1344.                 )
  1345.             );
  1346.         }
  1347.  
  1348.         $overlay_class = 'on' === $use_overlay ? ' et_pb_has_overlay' : '';
  1349.  
  1350.         if ( 'on' !== $fullwidth ) {
  1351.             wp_enqueue_script( 'salvattore' );
  1352.  
  1353.             $background_layout        = 'light';
  1354.             $background_layout_tablet = ! empty( $background_layout_tablet ) ? 'light' : '';
  1355.             $background_layout_phone  = ! empty( $background_layout_phone ) ? 'light' : '';
  1356.         }
  1357.  
  1358.         $args = array(
  1359.             'posts_per_page' => (int) $posts_number,
  1360.             'post_status'    => array( 'publish', 'private', 'inherit' ),
  1361.             'perm'           => 'readable',
  1362.             'post_type'      => $post_type,
  1363.             'order' => 'ASC',
  1364.         );
  1365.  
  1366.         $et_paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' );
  1367.  
  1368.         if ( $__et_blog_module_paged > 1 ) {
  1369.             $et_paged      = $__et_blog_module_paged;
  1370.             $paged         = $__et_blog_module_paged; //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1371.             $args['paged'] = $__et_blog_module_paged;
  1372.         }
  1373.  
  1374.         if ( is_front_page() ) {
  1375.             $paged = $et_paged; //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1376.         }
  1377.  
  1378.         $args['cat'] = implode( ',', self::filter_include_categories( $include_categories ) );
  1379.  
  1380.         $args['paged'] = $et_paged;
  1381.  
  1382.         if ( '' !== $offset_number && ! empty( $offset_number ) ) {
  1383.             /**
  1384.              * Offset + pagination don't play well. Manual offset calculation required
  1385.              *
  1386.              * @see: https://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination
  1387.              */
  1388.             if ( $paged > 1 ) {
  1389.                 $args['offset'] = ( ( $et_paged - 1 ) * intval( $posts_number ) ) + intval( $offset_number );
  1390.             } else {
  1391.                 $args['offset'] = intval( $offset_number );
  1392.             }
  1393.         }
  1394.  
  1395.         $main_query_post = ET_Post_Stack::get_main_post();
  1396.  
  1397.         if ( $main_query_post && is_singular( $main_query_post->post_type ) && ! isset( $args['post__not_in'] ) ) {
  1398.             $args['post__not_in'] = array( $main_query_post->ID );
  1399.         }
  1400.  
  1401.         // Images: Add CSS Filters and Mix Blend Mode rules (if set)
  1402.         if ( array_key_exists( 'image', $this->advanced_fields ) && array_key_exists( 'css', $this->advanced_fields['image'] ) ) {
  1403.             $this->add_classname(
  1404.                 $this->generate_css_filters(
  1405.                     $render_slug,
  1406.                     'child_',
  1407.                     self::$data_utils->array_get( $this->advanced_fields['image']['css'], 'main', '%%order_class%%' )
  1408.                 )
  1409.             );
  1410.         }
  1411.  
  1412.         self::$rendering = true;
  1413.  
  1414.         $post_meta_remove_keys = array(
  1415.             'show_author',
  1416.             'show_date',
  1417.             'show_categories',
  1418.             'show_comments',
  1419.         );
  1420.  
  1421.         $post_meta_removes = array(
  1422.             'desktop' => array(
  1423.                 'none' => 'none',
  1424.             ),
  1425.             'tablet'  => array(
  1426.                 'none' => 'none',
  1427.             ),
  1428.             'phone'   => array(
  1429.                 'none' => 'none',
  1430.             ),
  1431.             'hover'   => array(
  1432.                 'none' => 'none',
  1433.             ),
  1434.         );
  1435.  
  1436.         foreach ( $post_meta_removes as $mode => $post_meta_remove ) {
  1437.             foreach ( $post_meta_remove_keys as $post_meta_remove_key ) {
  1438.                 if ( $multi_view->has_value( $post_meta_remove_key, 'on', $mode, true ) ) {
  1439.                     continue;
  1440.                 }
  1441.  
  1442.                 $post_meta_remove[ $post_meta_remove_key ] = $post_meta_remove_key;
  1443.             }
  1444.  
  1445.             $post_meta_removes[ $mode ] = implode( ',', $post_meta_remove );
  1446.         }
  1447.  
  1448.         $multi_view->set_custom_prop( 'post_meta_removes', $post_meta_removes );
  1449.         $multi_view->set_custom_prop( 'post_content', $multi_view->get_values( 'show_content' ) );
  1450.  
  1451.         $show_thumbnail = $multi_view->has_value( 'show_thumbnail', 'on' );
  1452.  
  1453.         ob_start();
  1454.  
  1455.         // Stash properties that will not be the same after wp_reset_query().
  1456.         $wp_query_props = array(
  1457.             'current_post' => $wp_query->current_post,
  1458.             'in_the_loop'  => $wp_query->in_the_loop,
  1459.         );
  1460.  
  1461.         $show_no_results_template = true;
  1462.  
  1463.         if ( 'off' === $use_current_loop ) {
  1464.             query_posts( $args );
  1465.         } elseif ( is_singular() ) {
  1466.             // Force an empty result set in order to avoid loops over the current post.
  1467.             query_posts( array( 'post__in' => array( 0 ) ) );
  1468.             $show_no_results_template = false;
  1469.         } else {
  1470.             // Only allow certain args when `Posts For Current Page` is set.
  1471.             $original = $wp_query->query_vars;
  1472.             $custom   = array_intersect_key( $args, array_flip( array( 'posts_per_page', 'offset', 'paged' ) ) );
  1473.  
  1474.             // Trick WP into reporting this query as the main query so third party filters
  1475.             // that check for is_main_query() are applied.
  1476.             $wp_the_query = $wp_query = new WP_Query( array_merge( $original, $custom ) );
  1477.         }
  1478.  
  1479.         /**
  1480.          * Filters Blog module's main query.
  1481.          *
  1482.          * @since 4.7.0
  1483.          * @since 4.11.0 Pass modified module attributes.
  1484.          *
  1485.          * @param WP_Query $wp_query
  1486.          * @param array    $attrs    Modified module attributes.
  1487.          */
  1488.         $wp_query = apply_filters( 'et_builder_blog_query', $wp_query, $attrs ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- We intend to override $wp_query for blog module.
  1489.  
  1490.         // Manually set the max_num_pages to make the `next_posts_link` work
  1491.         if ( '' !== $offset_number && ! empty( $offset_number ) ) {
  1492.             global $wp_query;
  1493.             $wp_query->found_posts   = max( 0, $wp_query->found_posts - intval( $offset_number ) );
  1494.             $posts_number            = intval( $posts_number );
  1495.             $wp_query->max_num_pages = $posts_number > 1 ? ceil( $wp_query->found_posts / $posts_number ) : 1;
  1496.         }
  1497.  
  1498.         $blog_order                 = self::_get_index( array( self::INDEX_MODULE_ORDER, $render_slug ) );
  1499.         $items_count                = 0;
  1500.         $wp_query->et_pb_blog_query = true;
  1501.  
  1502.         if ( have_posts() ) {
  1503.             if ( 'off' === $fullwidth ) {
  1504.                 $attribute = et_core_is_fb_enabled() ? 'data-et-vb-columns' : 'data-columns';
  1505.                 echo '<div class="et_pb_salvattore_content" ' . et_core_intentionally_unescaped( $attribute, 'fixed_string' ) . '>';
  1506.             }
  1507.  
  1508.             while ( have_posts() ) {
  1509.                 the_post();
  1510.                 ET_Post_Stack::replace( $post );
  1511.  
  1512.                 $post_format = et_pb_post_format();
  1513.  
  1514.                 $thumb = '';
  1515.  
  1516.                 $width = 'on' === $fullwidth ? 1080 : 400;
  1517.                 $width = (int) apply_filters( 'et_pb_blog_image_width', $width );
  1518.  
  1519.                 $height    = 'on' === $fullwidth ? 675 : 250;
  1520.                 $height    = (int) apply_filters( 'et_pb_blog_image_height', $height );
  1521.                 $classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
  1522.                 $titletext = get_the_title();
  1523.                 $alttext   = get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true );
  1524.                 $thumbnail = get_thumbnail( $width, $height, $classtext, $alttext, $titletext, false, 'Blogimage' );
  1525.                 $thumb     = $thumbnail['thumb'];
  1526.  
  1527.                 $no_thumb_class = '' === $thumb || ! $show_thumbnail ? ' et_pb_no_thumb' : '';
  1528.  
  1529.                 if ( in_array( $post_format, array( 'video', 'gallery' ) ) ) {
  1530.                     $no_thumb_class = '';
  1531.                 }
  1532.  
  1533.                 $item_class = sprintf( ' et_pb_blog_item_%1$s_%2$s', $blog_order, $items_count );
  1534.                 $items_count++;
  1535.                 ?>
  1536.  
  1537.             <article id="post-<?php the_ID(); ?>" <?php post_class( 'et_pb_post clearfix' . $no_thumb_class . $overlay_class . $item_class ); ?>>
  1538.  
  1539.                 <?php
  1540.                 et_divi_post_format_content();
  1541.  
  1542.                 if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) || post_password_required( $post ) ) {
  1543.                     if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) :
  1544.                         $video_overlay = has_post_thumbnail() ? sprintf(
  1545.                             '<div class="et_pb_video_overlay" style="background-image: url(%1$s); background-size: cover;">
  1546.                                 <div class="et_pb_video_overlay_hover">
  1547.                                     <a href="#" class="et_pb_video_play"></a>
  1548.                                 </div>
  1549.                             </div>',
  1550.                             $thumb
  1551.                         ) : '';
  1552.  
  1553.                         printf(
  1554.                             '<div class="et_main_video_container">
  1555.                                 %1$s
  1556.                                 %2$s
  1557.                             </div>',
  1558.                             et_core_esc_previously( $video_overlay ),
  1559.                             et_core_esc_previously( $first_video )
  1560.                         );
  1561.                     elseif ( 'gallery' === $post_format ) :
  1562.                         et_pb_gallery_images( 'slider' );
  1563.                     elseif ( '' !== $thumb && $show_thumbnail ) :
  1564.                         if ( 'on' !== $fullwidth ) {
  1565.                             echo '<div class="et_pb_image_container">';
  1566.                         }
  1567.  
  1568.                         $thumbnail_output = print_thumbnail( $thumb, $thumbnail['use_timthumb'], $titletext, $width, $height, '', false );
  1569.  
  1570.                         if ( 'on' === $use_overlay ) {
  1571.                             $thumbnail_output .= et_core_esc_previously( $overlay_output );
  1572.                         }
  1573.  
  1574.                         if ( $thumbnail_output ) {
  1575.                             $multi_view->render_element(
  1576.                                 array(
  1577.                                     'tag'            => 'a',
  1578.                                     'content'        => $thumbnail_output,
  1579.                                     'attrs'          => array(
  1580.                                         'href'  => get_the_permalink(),
  1581.                                         'class' => 'entry-featured-image-url',
  1582.                                     ),
  1583.                                     'visibility'     => array(
  1584.                                         'show_thumbnail' => 'on',
  1585.                                     ),
  1586.                                     'required'       => array(
  1587.                                         'show_thumbnail' => 'on',
  1588.                                     ),
  1589.                                     'hover_selector' => '%%order_class%% .et_pb_post',
  1590.                                 ),
  1591.                                 true
  1592.                             );
  1593.                         }
  1594.  
  1595.                         if ( 'on' !== $fullwidth ) {
  1596.                             echo '</div>';
  1597.                         }
  1598.                     endif;
  1599.                 }
  1600.                 ?>
  1601.  
  1602.                 <?php if ( 'off' === $fullwidth || ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) || post_password_required( $post ) ) { ?>
  1603.                     <?php if ( ! in_array( $post_format, array( 'link', 'audio' ) ) || post_password_required( $post ) ) { ?>
  1604.                     <<?php echo et_core_intentionally_unescaped( $processed_header_level, 'fixed_string' ); ?> class="entry-title"><a href="<?php esc_url( the_permalink() ); ?>"><?php the_title(); ?></a></<?php echo et_core_intentionally_unescaped( $processed_header_level, 'fixed_string' ); ?>>
  1605.                 <?php } ?>
  1606.  
  1607.                     <?php
  1608.                     if ( 'on' === $show_author || 'on' === $show_date || 'on' === $show_categories || 'on' === $show_comments ) {
  1609.                         $multi_view->render_element(
  1610.                             array(
  1611.                                 'tag'            => 'p',
  1612.                                 'content'        => '{{post_meta_removes}}',
  1613.                                 'attrs'          => array(
  1614.                                     'class' => 'post-meta',
  1615.                                 ),
  1616.                                 'hover_selector' => '%%order_class%% .et_pb_post',
  1617.                             ),
  1618.                             true
  1619.                         );
  1620.                     }
  1621.  
  1622.                     echo '<div class="post-content">';
  1623.  
  1624.                     $multi_view->render_element(
  1625.                         array(
  1626.                             'tag'            => 'div',
  1627.                             'content'        => '{{post_content}}',
  1628.                             'attrs'          => array(
  1629.                                 'class' => 'post-content-inner',
  1630.                             ),
  1631.                             'visibility'     => array(
  1632.                                 'show_excerpt' => 'on',
  1633.                             ),
  1634.                             'classes'        => array(
  1635.                                 'et_pb_blog_show_content' => array(
  1636.                                     'show_content' => 'on',
  1637.                                 ),
  1638.                             ),
  1639.                             'hover_selector' => '%%order_class%% .et_pb_post',
  1640.                         ),
  1641.                         true
  1642.                     );
  1643.  
  1644.                     $more = $multi_view->render_element(
  1645.                         array(
  1646.                             'tag'            => 'a',
  1647.                             'content'        => esc_html__( 'read more', 'et_builder' ),
  1648.                             'attrs'          => array(
  1649.                                 'class' => 'more-link',
  1650.                                 'href'  => esc_url( get_permalink() ),
  1651.                             ),
  1652.                             'visibility'     => array(
  1653.                                 'show_content' => 'off',
  1654.                                 'show_more'    => 'on',
  1655.                             ),
  1656.                             'required'       => array(
  1657.                                 'show_content' => 'off',
  1658.                                 'show_more'    => 'on',
  1659.                             ),
  1660.                             'hover_selector' => '%%order_class%% .et_pb_post',
  1661.                         )
  1662.                     );
  1663.  
  1664.                     echo et_core_esc_previously( $more );
  1665.  
  1666.                     echo '</div>';
  1667.                     ?>
  1668.             <?php } // 'off' === $fullwidth || ! in_array( $post_format, array( 'link', 'audio', 'quote', 'gallery' ?>
  1669.  
  1670.             </article>
  1671.                 <?php
  1672.                 ET_Post_Stack::pop();
  1673.             } // endwhile
  1674.             ET_Post_Stack::reset();
  1675.  
  1676.             if ( 'off' === $fullwidth ) {
  1677.                 echo '</div>';
  1678.             }
  1679.  
  1680.             if ( $multi_view->has_value( 'show_pagination', 'on' ) ) {
  1681.                 $multi_view->render_element(
  1682.                     array(
  1683.                         'tag'            => 'div',
  1684.                         'content'        => $this->render_pagination( false ),
  1685.                         'visibility'     => array(
  1686.                             'show_pagination' => 'on',
  1687.                         ),
  1688.                         'hover_selector' => '%%order_class%% .et_pb_post',
  1689.                     ),
  1690.                     true
  1691.                 );
  1692.  
  1693.                 echo '</div>';
  1694.  
  1695.                 $container_is_closed = true;
  1696.             }
  1697.         } elseif ( $show_no_results_template ) {
  1698.             echo self::get_no_results_template( et_core_intentionally_unescaped( $processed_header_level, 'fixed_string' ) );
  1699.         }
  1700.  
  1701.         unset( $wp_query->et_pb_blog_query );
  1702.  
  1703.         $wp_the_query = $wp_query = $main_query;
  1704.         wp_reset_query();
  1705.         ET_Post_Stack::reset();
  1706.  
  1707.         // Restore stashed properties.
  1708.         foreach ( $wp_query_props as $prop => $value ) {
  1709.             $wp_query->{$prop} = $value;
  1710.         }
  1711.  
  1712.         $posts = ob_get_contents();
  1713.  
  1714.         ob_end_clean();
  1715.         self::$rendering = false;
  1716.  
  1717.         // Remove automatically added classnames
  1718.         $this->remove_classname(
  1719.             array(
  1720.                 $render_slug,
  1721.             )
  1722.         );
  1723.  
  1724.         // Background layout data attributes.
  1725.         $background_layout_props = array_merge(
  1726.             $this->props,
  1727.             array(
  1728.                 'background_layout'        => $background_layout,
  1729.                 'background_layout_tablet' => $background_layout_tablet,
  1730.                 'background_layout_phone'  => $background_layout_phone,
  1731.             )
  1732.         );
  1733.         $data_background_layout  = et_pb_background_layout_options()->get_background_layout_attrs( $background_layout_props );
  1734.  
  1735.         if ( 'on' !== $fullwidth ) {
  1736.             // Module classname
  1737.             $this->add_classname(
  1738.                 array(
  1739.                     'et_pb_blog_grid_wrapper',
  1740.                     "et_pb_bg_layout_{$background_layout}",
  1741.                 )
  1742.             );
  1743.  
  1744.             // Remove auto-added classname for module wrapper because on grid mode these classnames
  1745.             // are placed one level below module wrapper
  1746.             $this->remove_classname(
  1747.                 array(
  1748.                     'et_pb_section_video',
  1749.                     'et_pb_preload',
  1750.                     'et_pb_section_parallax',
  1751.                 )
  1752.             );
  1753.  
  1754.             // Inner module wrapper classname
  1755.             $inner_wrap_classname = array(
  1756.                 'et_pb_blog_grid',
  1757.                 'clearfix',
  1758.                 $this->get_text_orientation_classname(),
  1759.             );
  1760.  
  1761.             // Background layout class names.
  1762.             $background_layout_class_names = et_pb_background_layout_options()->get_background_layout_class( $background_layout_props, false, true );
  1763.             array_merge( $inner_wrap_classname, $background_layout_class_names );
  1764.  
  1765.             if ( '' !== $video_background ) {
  1766.                 $inner_wrap_classname[] = 'et_pb_section_video';
  1767.                 $inner_wrap_classname[] = 'et_pb_preload';
  1768.             }
  1769.  
  1770.             if ( '' !== $parallax_image_background ) {
  1771.                 $inner_wrap_classname[] = 'et_pb_section_parallax';
  1772.             }
  1773.  
  1774.             $output = sprintf(
  1775.                 '<div%4$s class="%5$s"%9$s>
  1776.                     <div class="%1$s">
  1777.                     %7$s
  1778.                     %6$s
  1779.                     %10$s
  1780.                     %11$s
  1781.                     <div class="et_pb_ajax_pagination_container">
  1782.                         %2$s
  1783.                     </div>
  1784.                     %3$s %8$s
  1785.                 </div>',
  1786.                 esc_attr( implode( ' ', $inner_wrap_classname ) ),
  1787.                 $posts,
  1788.                 ( ! $container_is_closed ? '</div>' : '' ),
  1789.                 $this->module_id(),
  1790.                 $this->module_classname( $render_slug ), // #5
  1791.                 $video_background,
  1792.                 $parallax_image_background,
  1793.                 $this->drop_shadow_back_compatibility( $render_slug ),
  1794.                 et_core_esc_previously( $data_background_layout ),
  1795.                 et_core_esc_previously( $this->background_pattern() ), // #10
  1796.                 et_core_esc_previously( $this->background_mask() ) // #11
  1797.             );
  1798.         } else {
  1799.             // Module classname
  1800.             $this->add_classname(
  1801.                 array(
  1802.                     'et_pb_posts',
  1803.                     "et_pb_bg_layout_{$background_layout}",
  1804.                     $this->get_text_orientation_classname(),
  1805.                 )
  1806.             );
  1807.  
  1808.             if ( ! empty( $background_layout_tablet ) ) {
  1809.                 $this->add_classname( "et_pb_bg_layout_{$background_layout_tablet}_tablet" );
  1810.             }
  1811.  
  1812.             if ( ! empty( $background_layout_phone ) ) {
  1813.                 $this->add_classname( "et_pb_bg_layout_{$background_layout_phone}_phone" );
  1814.             }
  1815.  
  1816.             $output = sprintf(
  1817.                 '<div%4$s class="%1$s"%8$s>
  1818.                 %6$s
  1819.                 %5$s
  1820.                 %9$s
  1821.                 %10$s
  1822.                 <div class="et_pb_ajax_pagination_container">
  1823.                     %2$s
  1824.                 </div>
  1825.                 %3$s %7$s',
  1826.                 $this->module_classname( $render_slug ),
  1827.                 $posts,
  1828.                 ( ! $container_is_closed ? '</div>' : '' ),
  1829.                 $this->module_id(),
  1830.                 $video_background, // #5
  1831.                 $parallax_image_background,
  1832.                 $this->drop_shadow_back_compatibility( $render_slug ),
  1833.                 et_core_esc_previously( $data_background_layout ),
  1834.                 et_core_esc_previously( $this->background_pattern() ), // #9
  1835.                 et_core_esc_previously( $this->background_mask() ) // #10
  1836.             );
  1837.         }
  1838.  
  1839.         // Restore $wp_filter
  1840.         $wp_filter = $wp_filter_cache; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1841.         unset( $wp_filter_cache );
  1842.  
  1843.         // Restore global $post into its original state when et_pb_blog shortcode ends to avoid
  1844.         // the rest of the page uses incorrect global $post variable
  1845.         $post = $post_cache; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1846.  
  1847.         return $output;
  1848.     }
  1849.  
  1850.     public function process_box_shadow( $function_name ) {
  1851.         if ( isset( $this->props['fullwidth'] ) && $this->props['fullwidth'] === 'off' ) {
  1852.             // Only override 'default' box shadow because we also defined
  1853.             // box shadow settings for the image.
  1854.             $this->advanced_fields['box_shadow']['default'] = array(
  1855.                 'css' => array(
  1856.                     'main'    => '%%order_class%% article.et_pb_post',
  1857.                     'hover'   => '%%order_class%% article.et_pb_post:hover',
  1858.                     'overlay' => 'inset',
  1859.                 ),
  1860.             );
  1861.         }
  1862.  
  1863.         parent::process_box_shadow( $function_name );
  1864.     }
  1865.  
  1866.     /**
  1867.      * Since the styling file is not updated until the author updates the page/post,
  1868.      * we should keep the drop shadow visible.
  1869.      *
  1870.      * @param string $functions_name
  1871.      *
  1872.      * @return string
  1873.      */
  1874.     private function drop_shadow_back_compatibility( $functions_name ) {
  1875.         $utils = ET_Core_Data_Utils::instance();
  1876.         $atts  = $this->props;
  1877.  
  1878.         if (
  1879.             version_compare( $utils->array_get( $atts, '_builder_version', '3.0.93' ), '3.0.94', 'lt' )
  1880.             &&
  1881.             'on' !== $utils->array_get( $atts, 'fullwidth' )
  1882.             &&
  1883.             'on' === $utils->array_get( $atts, 'use_dropshadow' )
  1884.         ) {
  1885.             $class = self::get_module_order_class( $functions_name );
  1886.  
  1887.             return sprintf(
  1888.                 '<style>%1$s</style>',
  1889.                 sprintf( '.%1$s  article.et_pb_post { box-shadow: 0 1px 5px rgba(0,0,0,.1) }', esc_html( $class ) )
  1890.             );
  1891.         }
  1892.  
  1893.         return '';
  1894.     }
  1895.  
  1896.     /**
  1897.      * Filter multi view value.
  1898.      *
  1899.      * @since 3.27.1
  1900.      *
  1901.      * @see ET_Builder_Module_Helper_MultiViewOptions::filter_value
  1902.      *
  1903.      * @param mixed                                     $raw_value Props raw value.
  1904.      * @param array                                     $args {
  1905.      *                                         Context data.
  1906.      *
  1907.      *     @type string $context      Context param: content, attrs, visibility, classes.
  1908.      *     @type string $name         Module options props name.
  1909.      *     @type string $mode         Current data mode: desktop, hover, tablet, phone.
  1910.      *     @type string $attr_key     Attribute key for attrs context data. Example: src, class, etc.
  1911.      *     @type string $attr_sub_key Attribute sub key that availabe when passing attrs value as array such as styes. Example: padding-top, margin-botton, etc.
  1912.      * }
  1913.      * @param ET_Builder_Module_Helper_MultiViewOptions $multi_view Multiview object instance.
  1914.      *
  1915.      * @return mixed
  1916.      */
  1917.     public function multi_view_filter_value( $raw_value, $args, $multi_view ) {
  1918.         $name    = isset( $args['name'] ) ? $args['name'] : '';
  1919.         $mode    = isset( $args['mode'] ) ? $args['mode'] : '';
  1920.         $context = isset( $args['context'] ) ? $args['context'] : '';
  1921.  
  1922.         if ( 'post_content' === $name && 'content' === $context ) {
  1923.             global $et_pb_rendering_column_content;
  1924.  
  1925.             $post_content = et_strip_shortcodes( et_delete_post_first_video( get_the_content() ), true );
  1926.  
  1927.             $et_pb_rendering_column_content = true;
  1928.  
  1929.             if ( 'on' === $raw_value ) {
  1930.                 global $more;
  1931.  
  1932.                 if ( et_pb_is_pagebuilder_used( get_the_ID() ) ) {
  1933.                     $more      = 1; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1934.                     $raw_value = et_core_intentionally_unescaped( apply_filters( 'the_content', $post_content ), 'html' );
  1935.                 } else {
  1936.                     $more      = null; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
  1937.                     $raw_value = et_core_intentionally_unescaped( apply_filters( 'the_content', et_delete_post_first_video( get_the_content( esc_html__( 'read more...', 'et_builder' ) ) ) ), 'html' );
  1938.                 }
  1939.             } else {
  1940.                 $use_manual_excerpt = isset( $this->props['use_manual_excerpt'] ) ? $this->props['use_manual_excerpt'] : 'off';
  1941.                 $excerpt_length     = isset( $this->props['excerpt_length'] ) ? $this->props['excerpt_length'] : 270;
  1942.  
  1943.                 if ( has_excerpt() && 'off' !== $use_manual_excerpt ) {
  1944.                     /**
  1945.                      * Filters the displayed post excerpt.
  1946.                      *
  1947.                      * @since 3.29
  1948.                      *
  1949.                      * @param string $post_excerpt The post excerpt.
  1950.                      */
  1951.                     $raw_value = apply_filters( 'the_excerpt', get_the_excerpt() );
  1952.                 } else {
  1953.                     $raw_value = et_core_intentionally_unescaped( wpautop( et_delete_post_first_video( strip_shortcodes( truncate_post( $excerpt_length, false, '', true ) ) ) ), 'html' );
  1954.                 }
  1955.             }
  1956.  
  1957.             $et_pb_rendering_column_content = false;
  1958.         } elseif ( 'show_content' === $name && 'visibility' === $context ) {
  1959.             $raw_value = $multi_view->has_value( $name, 'on', $mode, true ) ? 'on' : $raw_value;
  1960.         } elseif ( 'post_meta_removes' === $name && 'content' === $context ) {
  1961.             $post_meta_remove_keys = array(
  1962.                 'show_author'     => true,
  1963.                 'show_date'       => true,
  1964.                 'show_categories' => true,
  1965.                 'show_comments'   => true,
  1966.             );
  1967.  
  1968.             $post_meta_removes = explode( ',', $raw_value );
  1969.  
  1970.             if ( $post_meta_removes ) {
  1971.                 foreach ( $post_meta_removes as $post_meta_remove ) {
  1972.                     unset( $post_meta_remove_keys[ $post_meta_remove ] );
  1973.                 }
  1974.             }
  1975.  
  1976.             $post_meta_datas = array();
  1977.  
  1978.             if ( isset( $post_meta_remove_keys['show_author'] ) ) {
  1979.                 $post_meta_datas[] = et_get_safe_localization( sprintf( __( 'by %s', 'et_builder' ), '<span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>' ) );
  1980.             }
  1981.  
  1982.             if ( isset( $post_meta_remove_keys['show_date'] ) ) {
  1983.                 $post_meta_datas[] = et_get_safe_localization( sprintf( __( '%s', 'et_builder' ), '<span class="published">' . esc_html( get_the_date( $this->props['meta_date'] ) ) . '</span>' ) );
  1984.             }
  1985.  
  1986.             if ( isset( $post_meta_remove_keys['show_categories'] ) ) {
  1987.                 $post_meta_datas[] = et_builder_get_the_term_list( ', ' );
  1988.             }
  1989.  
  1990.             if ( isset( $post_meta_remove_keys['show_comments'] ) ) {
  1991.                 $post_meta_datas[] = sprintf( esc_html( _nx( '%s Comment', '%s Comments', get_comments_number(), 'number of comments', 'et_builder' ) ), number_format_i18n( get_comments_number() ) );
  1992.             }
  1993.  
  1994.             $raw_value = implode( ' | ', $post_meta_datas );
  1995.         }
  1996.  
  1997.         return $raw_value;
  1998.     }
  1999. }
  2000.  
  2001. if ( et_builder_should_load_all_module_data() ) {
  2002.     //new ET_Builder_Module_Blog_ASC();
  2003. }
  2004.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement