require_once 'helpers/Overlay.php';
class ET_Builder_Module_Blog extends ET_Builder_Module_Type_PostBased {
* Track if the module is currently rendering to prevent unnecessary rendering and recursion.
protected static $rendering = false;
$this->name = esc_html__( 'Blog', 'et_builder' );
$this->plural = esc_html__( 'Blogs', 'et_builder' );
$this->slug = 'et_pb_blog';
$this->vb_support = 'on';
$this->main_css_element = '%%order_class%% .et_pb_post';
$this->settings_modal_toggles = array(
'main_content' => et_builder_i18n( 'Content' ),
'elements' => et_builder_i18n( 'Elements' ),
'layout' => et_builder_i18n( 'Layout' ),
'overlay' => et_builder_i18n( 'Overlay' ),
'title' => et_builder_i18n( 'Image' ),
'title' => et_builder_i18n( 'Text' ),
$this->advanced_fields = array(
'label' => et_builder_i18n( 'Title' ),
'main' => "{$this->main_css_element} .entry-title, %%order_class%% .not-found-title",
'font' => "{$this->main_css_element} .entry-title a, %%order_class%% .not-found-title",
'color' => "{$this->main_css_element} .entry-title a, %%order_class%% .not-found-title",
'limited_main' => "{$this->main_css_element} .entry-title, {$this->main_css_element} .entry-title a, %%order_class%% .not-found-title",
'hover' => "{$this->main_css_element}:hover .entry-title, {$this->main_css_element}:hover .entry-title:hover a, %%order_class%% .not-found-title",
'color_hover' => "{$this->main_css_element}:hover .entry-title a, %%order_class%%:hover .not-found-title",
'computed_affects' => array(
'label' => et_builder_i18n( 'Body' ),
'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",
'color' => "{$this->main_css_element}, {$this->main_css_element} .post-content *",
'line_height' => "{$this->main_css_element} p",
'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",
'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",
'color_hover' => "{$this->main_css_element}:hover, {$this->main_css_element}:hover .post-content *",
'block_elements' => array(
'tabbed_subtoggles' => true,
'bb_icons_support' => true,
'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",
'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",
'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",
'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",
'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",
'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",
'label' => esc_html__( 'Meta', 'et_builder' ),
'main' => "{$this->main_css_element} .post-meta, {$this->main_css_element} .post-meta a",
'limited_main' => "{$this->main_css_element} .post-meta, {$this->main_css_element} .post-meta a, {$this->main_css_element} .post-meta span",
'hover' => "{$this->main_css_element}:hover .post-meta, {$this->main_css_element}:hover .post-meta a, {$this->main_css_element}:hover .post-meta span",
'label' => esc_html__( 'Read More', 'et_builder' ),
'main' => "{$this->main_css_element} div.post-content a.more-link",
'hover' => "{$this->main_css_element} div.post-content a.more-link:hover",
'hide_text_align' => true,
'label' => esc_html__( 'Pagination', 'et_builder' ),
'main' => function_exists( 'wp_pagenavi' ) ? '%%order_class%% .wp-pagenavi a, %%order_class%% .wp-pagenavi span' : '%%order_class%% .pagination a',
'important' => function_exists( 'wp_pagenavi' ) ? 'all' : array(),
'text_align' => '%%order_class%% .wp-pagenavi',
'hover' => function_exists( 'wp_pagenavi' ) ? '%%order_class%% .wp-pagenavi a:hover, %%order_class%% .wp-pagenavi span:hover' : '%%order_class%% .pagination a:hover',
'hide_text_align' => ! function_exists( 'wp_pagenavi' ),
'options' => et_builder_get_text_orientation_options( array( 'justified' ), array() ),
'main' => '%%order_class%%',
'border_radii' => '%%order_class%% .et_pb_blog_grid .et_pb_post',
'border_styles' => '%%order_class%% .et_pb_blog_grid .et_pb_post',
'border_styles_hover' => '%%order_class%% .et_pb_blog_grid .et_pb_post:hover',
'depends_on' => array( 'fullwidth' ),
'depends_show_if' => 'off',
'border_radii' => 'on||||',
'border_styles' => array(
'label_prefix' => esc_html__( 'Grid Layout', 'et_builder' ),
'border_radii' => '%%order_class%%:not(.et_pb_blog_grid_wrapper) .et_pb_post',
'border_styles' => '%%order_class%%:not(.et_pb_blog_grid_wrapper) .et_pb_post',
'depends_on' => array( 'fullwidth' ),
'depends_show_if' => 'on',
'border_radii' => 'on||||',
'border_styles' => array(
'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',
'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',
'label_prefix' => et_builder_i18n( 'Image' ),
'tab_slug' => 'advanced',
'toggle_slug' => 'image',
'label' => esc_html__( 'Image Box Shadow', 'et_builder' ),
'option_category' => 'layout',
'tab_slug' => 'advanced',
'toggle_slug' => 'image',
'main' => '%%order_class%% .entry-featured-image-url, %%order_class%% img, %%order_class%% .et_pb_slides, %%order_class%% .et_pb_video_overlay',
'default_on_fronts' => array(
'main' => '%%order_class%%',
'margin_padding' => array(
'main' => '%%order_class%%',
'important' => array( 'custom_margin' ),
'use_background_layout' => true,
'text_shadow' => '%%order_class%%',
'background_layout' => array(
'depends_show_if' => 'on',
'default_on_front' => 'light',
'main' => '%%order_class%%',
'child_filters_target' => array(
'tab_slug' => 'advanced',
'toggle_slug' => 'image',
'%%order_class%% .et_pb_slides',
'%%order_class%% .et_pb_video_overlay',
'scroll_effects' => array(
$this->custom_css_fields = array(
'label' => et_builder_i18n( 'Title' ),
'selector' => '.entry-title',
'label' => et_builder_i18n( 'Body' ),
'selector' => '.post-content',
'label' => esc_html__( 'Post Meta', 'et_builder' ),
'selector' => '.post-meta',
'label' => esc_html__( 'Pagenavi', 'et_builder' ),
'selector' => '.wp_pagenavi',
'featured_image' => array(
'label' => esc_html__( 'Featured Image', 'et_builder' ),
'selector' => '.entry-featured-image-url img',
'label' => esc_html__( 'Read More Button', 'et_builder' ),
'selector' => 'a.more-link',
$this->help_videos = array(
'name' => esc_html__( 'An introduction to the Blog module', 'et_builder' ),
'name' => esc_html__( 'How To Use Divi Blog Post Formats', 'et_builder' ),
'label' => et_builder_i18n( 'Layout' ),
'option_category' => 'layout',
'on' => esc_html__( 'Fullwidth', 'et_builder' ),
'off' => esc_html__( 'Grid', 'et_builder' ),
'masonry_tile_background_color',
'border_radii_fullwidth',
'border_styles_fullwidth',
'description' => esc_html__( 'Toggle between the various blog layout types.', 'et_builder' ),
'computed_affects' => array(
'tab_slug' => 'advanced',
'toggle_slug' => 'layout',
'default_on_front' => 'on',
'use_current_loop' => array(
'label' => esc_html__( 'Posts For Current Page', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'on' => et_builder_i18n( 'Yes' ),
'off' => et_builder_i18n( 'No' ),
'description' => esc_html__( 'Display posts for the current page. Useful on archive and index pages.', 'et_builder' ),
'computed_affects' => array(
'toggle_slug' => 'main_content',
'function.isTBLayout' => 'on',
'label' => esc_html__( 'Post Type', 'et_builder' ),
'option_category' => 'configuration',
'options' => et_get_registered_post_type_options( false, false ),
'description' => esc_html__( 'Choose posts of which post type you would like to display.', 'et_builder' ),
'computed_affects' => array(
'toggle_slug' => 'main_content',
'use_current_loop' => 'off',
'label' => esc_html__( 'Post Count', 'et_builder' ),
'option_category' => 'configuration',
'description' => esc_html__( 'Choose how much posts you would like to display per page.', 'et_builder' ),
'computed_affects' => array(
'toggle_slug' => 'main_content',
'include_categories' => array(
'label' => esc_html__( 'Included Categories', 'et_builder' ),
'meta_categories' => array(
'all' => esc_html__( 'All Categories', 'et_builder' ),
'current' => esc_html__( 'Current Category', 'et_builder' ),
'option_category' => 'basic_option',
'renderer_options' => array(
'description' => esc_html__( 'Choose which categories you would like to include in the feed.', 'et_builder' ),
'toggle_slug' => 'main_content',
'computed_affects' => array(
'use_current_loop' => 'off',
'label' => esc_html__( 'Date Format', 'et_builder' ),
'option_category' => 'configuration',
'description' => esc_html__( 'If you would like to adjust the date format, input the appropriate PHP date format here.', 'et_builder' ),
'toggle_slug' => 'main_content',
'computed_affects' => array(
'show_thumbnail' => array(
'label' => esc_html__( 'Show Featured Image', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'on' => et_builder_i18n( 'Yes' ),
'off' => et_builder_i18n( 'No' ),
'description' => esc_html__( 'This will turn thumbnails on and off.', 'et_builder' ),
'computed_affects' => array(
'toggle_slug' => 'elements',
'default_on_front' => 'on',
'mobile_options' => true,
'label' => esc_html__( 'Content Length', 'et_builder' ),
'option_category' => 'configuration',
'off' => esc_html__( 'Show Excerpt', 'et_builder' ),
'on' => esc_html__( 'Show Content', 'et_builder' ),
'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' ),
'toggle_slug' => 'main_content',
'computed_affects' => array(
'default_on_front' => 'off',
'mobile_options' => true,
'use_manual_excerpt' => array(
'label' => esc_html__( 'Use Post Excerpts', 'et_builder' ),
'description' => esc_html__( 'Disable this option if you want to ignore manually defined excerpts and always generate it automatically.', 'et_builder' ),
'type' => 'yes_no_button',
'on' => et_builder_i18n( 'Yes' ),
'off' => et_builder_i18n( 'No' ),
'computed_affects' => array(
'depends_show_if' => 'off',
'toggle_slug' => 'main_content',
'option_category' => 'configuration',
'excerpt_length' => array(
'label' => esc_html__( 'Excerpt Length', 'et_builder' ),
'description' => esc_html__( 'Define the length of automatically generated excerpts. Leave blank for default ( 270 ) ', 'et_builder' ),
'computed_affects' => array(
'depends_show_if' => 'off',
'toggle_slug' => 'main_content',
'option_category' => 'configuration',
'label' => esc_html__( 'Show Read More Button', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'off' => et_builder_i18n( 'No' ),
'on' => et_builder_i18n( 'Yes' ),
'depends_show_if' => 'off',
'description' => esc_html__( 'Here you can define whether to show "read more" link after the excerpts or not.', 'et_builder' ),
'computed_affects' => array(
'toggle_slug' => 'elements',
'default_on_front' => 'off',
'mobile_options' => true,
'label' => esc_html__( 'Show Author', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'on' => et_builder_i18n( 'Yes' ),
'off' => et_builder_i18n( 'No' ),
'description' => esc_html__( 'Turn on or off the author link.', 'et_builder' ),
'computed_affects' => array(
'toggle_slug' => 'elements',
'default_on_front' => 'on',
'mobile_options' => true,
'label' => esc_html__( 'Show Date', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'on' => et_builder_i18n( 'Yes' ),
'off' => et_builder_i18n( 'No' ),
'description' => esc_html__( 'Turn the date on or off.', 'et_builder' ),
'computed_affects' => array(
'toggle_slug' => 'elements',
'default_on_front' => 'on',
'mobile_options' => true,