'<p class="post-meta">%1$s %2$s %3$s %4$s %5$s %6$s %7$s</p>',
et_core_esc_previously( $author ),
et_core_intentionally_unescaped( $author_separator, 'fixed_string' ),
et_core_esc_previously( $date ),
et_core_intentionally_unescaped( $date_separator, 'fixed_string' ),
et_core_esc_wp( $categories ),
et_core_intentionally_unescaped( $categories_separator, 'fixed_string' ),
et_core_esc_previously( $comments )
$post_content = et_strip_shortcodes( et_delete_post_first_video( get_the_content() ), true );
// reset the fb processing flag
$et_fb_processing_shortcode_object = false;
// set the flag to indicate that we're processing internal content
$et_pb_rendering_column_content = true;
// reset all the attributes required to properly generate the internal styles
ET_Builder_Element::clean_internal_modules_styles();
echo '<div class="post-content">';
if ( 'on' === $args['show_content'] ) {
// page builder doesn't support more tag, so display the_content() in case of post made with page builder
if ( et_pb_is_pagebuilder_used( get_the_ID() ) ) {
$more = 1; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
echo et_core_intentionally_unescaped( apply_filters( 'the_content', $post_content ), 'html' );
$more = null; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
echo et_core_intentionally_unescaped( apply_filters( 'the_content', et_delete_post_first_video( get_the_content( esc_html__( 'read more...', 'et_builder' ) ) ) ), 'html' );
} elseif ( 'on' === $args['show_excerpt'] ) {
if ( has_excerpt() && 'off' !== $args['use_manual_excerpt'] ) {
if ( '' !== $post_content ) {
// set the $et_fb_processing_shortcode_object to false, to retrieve the content inside truncate_post() correctly
$et_fb_processing_shortcode_object = false;
echo et_core_intentionally_unescaped( wpautop( et_delete_post_first_video( strip_shortcodes( truncate_post( $excerpt_length, false, '', true ) ) ) ), 'html' );
// reset the $et_fb_processing_shortcode_object to its original value
$et_fb_processing_shortcode_object = $global_processing_original_value;
$et_fb_processing_shortcode_object = $global_processing_original_value;
// retrieve the styles for the modules inside Blog content
$internal_style = ET_Builder_Element::get_style( true );
// reset all the attributes after we retrieved styles
ET_Builder_Element::clean_internal_modules_styles( false );
$et_pb_rendering_column_content = false;
// append styles to the blog content
'<style type="text/css" class="et_fb_blog_inner_content_styles">
et_core_esc_previously( $internal_style )
if ( 'on' !== $args['show_content'] ) {
$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
echo et_core_esc_previously( $more );
<?php } // 'off' === $fullwidth || ! in_array( $post_format, array( 'link', 'audio', 'quote', 'gallery' ?>
$et_fb_processing_shortcode_object = $global_processing_original_value;
if ( 'on' !== $args['fullwidth'] ) {
if ( 'on' === $args['show_pagination'] ) {
// echo '</div> <!-- .et_pb_posts -->'; // @todo this causes closing tag issue
$container_is_closed = true;
if ( function_exists( 'wp_pagenavi' ) ) {
if ( $et_is_builder_plugin_active ) {
include ET_BUILDER_PLUGIN_DIR . 'includes/navigation.php';
get_template_part( 'includes/navigation', 'index' );
unset( $wp_query->et_pb_blog_query );
// Reset $wp_query to its origin
$wp_query = $wp_query_page; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
if ( ! $posts = ob_get_clean() ) {
$posts = self::get_no_results_template( et_core_esc_previously( $processed_header_level ) );
self::$rendering = false;
* Render pagination element
* @param bool $echo Wether to print the output or return it.
function render_pagination( $echo = true ) {
add_filter( 'get_pagenum_link', array( 'ET_Builder_Module_Blog', 'filter_pagination_url' ) );
if ( function_exists( 'wp_pagenavi' ) ) {
if ( et_is_builder_plugin_active() ) {
include ET_BUILDER_PLUGIN_DIR . 'includes/navigation.php';
get_template_part( 'includes/navigation', 'index' );
remove_filter( 'get_pagenum_link', array( 'ET_Builder_Module_Blog', 'filter_pagination_url' ) );
$output = ob_get_contents();
* Filter the pagination url to add a flag so it can be filtered to avoid pagination clashes with the main query.
* @param integer $pagenum
public static function filter_pagination_url( $result ) {
return add_query_arg( 'et_blog', '', $result );
* Renders the module output.
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
public function render( $attrs, $content, $render_slug ) {
global $post, $paged, $wp_query, $wp_the_query, $wp_filter, $__et_blog_module_paged;
if ( self::$rendering ) {
// We are trying to render a Blog module while a Blog module is already being rendered
// which means we have most probably hit an infinite recursion. While not necessarily
// the case, rendering a post which renders a Blog module which renders a post
// which renders a Blog module is not a sensible use-case.
// Keep a reference to the real main query to restore from later.
$main_query = $wp_the_query;
// Stored current global post as variable so global $post variable can be restored
// to its original state when et_pb_blog shortcode ends to avoid incorrect global $post
// being used on the page (i.e. blog + shop module in backend builder)
* Cached $wp_filter so it can be restored at the end of the callback.
* This is needed because this callback uses the_content filter / calls a function
* which uses the_content filter. WordPress doesn't support nested filter
$wp_filter_cache = $wp_filter;
$sticky = et_pb_sticky_options();
$multi_view = et_pb_multi_view_options( $this );
$use_current_loop = isset( $this->props['use_current_loop'] ) ? $this->props['use_current_loop'] : 'off';
$post_type = isset( $this->props['post_type'] ) ? $this->props['post_type'] : 'post';
$fullwidth = $this->props['fullwidth'];
$posts_number = $this->props['posts_number'];
$include_categories = $this->props['include_categories'];
$meta_date = $this->props['meta_date'];
$show_thumbnail = $this->props['show_thumbnail'];
$show_content = $this->props['show_content'];
$show_author = $this->props['show_author'];
$show_date = $this->props['show_date'];
$show_categories = $this->props['show_categories'];
$show_comments = $this->props['show_comments'];
$show_excerpt = $this->props['show_excerpt'];
$use_manual_excerpt = $this->props['use_manual_excerpt'];
$excerpt_length = $this->props['excerpt_length'];
$show_pagination = $this->props['show_pagination'];
$show_more = $this->props['show_more'];
$offset_number = $this->props['offset_number'];
$use_overlay = $this->props['use_overlay'];
$header_level = $this->props['header_level'];
$background_layout = $this->props['background_layout'];
$background_layout_hover = et_pb_hover_options()->get_value( 'background_layout', $this->props, 'light' );
$background_layout_hover_enabled = et_pb_hover_options()->is_enabled( 'background_layout', $this->props );
$background_layout_values = et_pb_responsive_options()->get_property_values( $this->props, 'background_layout' );
$background_layout_tablet = isset( $background_layout_values['tablet'] ) ? $background_layout_values['tablet'] : '';
$background_layout_phone = isset( $background_layout_values['phone'] ) ? $background_layout_values['phone'] : '';
$hover_icon = $this->props['hover_icon'];
$hover_icon_values = et_pb_responsive_options()->get_property_values( $this->props, 'hover_icon' );
$hover_icon_tablet = isset( $hover_icon_values['tablet'] ) ? $hover_icon_values['tablet'] : '';
$hover_icon_phone = isset( $hover_icon_values['phone'] ) ? $hover_icon_values['phone'] : '';
$hover_icon_sticky = $sticky->get_value( 'hover_icon', $this->props );
$video_background = $this->video_background();
$parallax_image_background = $this->get_parallax_image_background();
$container_is_closed = false;
$processed_header_level = et_pb_process_header_level( $header_level, 'h2' );
// some themes do not include these styles/scripts so we need to enqueue them in this module to support audio post format
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-mediaelement' );
// include easyPieChart which is required for loading Blog module content via ajax correctly
wp_enqueue_script( 'easypiechart' );
// include ET Shortcode scripts
wp_enqueue_script( 'et-shortcodes-js' );
// remove all filters from WP audio shortcode to make sure current theme doesn't add any elements into audio module
remove_all_filters( 'wp_audio_shortcode_library' );
remove_all_filters( 'wp_audio_shortcode' );
remove_all_filters( 'wp_audio_shortcode_class' );
// Masonry Tile Background color.
'base_attr_name' => 'masonry_tile_background_color',
'selector' => '%%order_class%% .et_pb_blog_grid .et_pb_post',
'css_property' => 'background-color',
'render_slug' => $render_slug,
'base_attr_name' => 'overlay_icon_color',
'selector' => '%%order_class%% .et_overlay:before',
'css_property' => 'color',
'render_slug' => $render_slug,
'base_attr_name' => 'hover_overlay_color',
'selector' => '%%order_class%% .et_overlay',
'css_property' => 'background-color',
'render_slug' => $render_slug,
if ( 'on' === $use_overlay ) {
$overlay_output = ET_Builder_Module_Helper_Overlay::render(
'icon_tablet' => $hover_icon_tablet,
'icon_phone' => $hover_icon_phone,
'icon_sticky' => $hover_icon_sticky,
$overlay_class = 'on' === $use_overlay ? ' et_pb_has_overlay' : '';
if ( 'on' !== $fullwidth ) {
wp_enqueue_script( 'salvattore' );
$background_layout = 'light';
$background_layout_tablet = ! empty( $background_layout_tablet ) ? 'light' : '';
$background_layout_phone = ! empty( $background_layout_phone ) ? 'light' : '';
'posts_per_page' => (int) $posts_number,
'post_status' => array( 'publish', 'private' ),
'post_type' => $post_type,
$et_paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' );
if ( $__et_blog_module_paged > 1 ) {
$et_paged = $__et_blog_module_paged;
$paged = $__et_blog_module_paged; //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
$args['paged'] = $__et_blog_module_paged;
$paged = $et_paged; //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
$args['cat'] = implode( ',', self::filter_include_categories( $include_categories ) );
$args['paged'] = $et_paged;
if ( '' !== $offset_number && ! empty( $offset_number ) ) {
* Offset + pagination don't play well. Manual offset calculation required
* @see: https://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination
$args['offset'] = ( ( $et_paged - 1 ) * intval( $posts_number ) ) + intval( $offset_number );
$args['offset'] = intval( $offset_number );
$main_query_post = ET_Post_Stack::get_main_post();
if ( $main_query_post && is_singular( $main_query_post->post_type ) && ! isset( $args['post__not_in'] ) ) {
$args['post__not_in'] = array( $main_query_post->ID );
// Images: Add CSS Filters and Mix Blend Mode rules (if set)
if ( array_key_exists( 'image', $this->advanced_fields ) && array_key_exists( 'css', $this->advanced_fields['image'] ) ) {
$this->generate_css_filters(
self::$data_utils->array_get( $this->advanced_fields['image']['css'], 'main', '%%order_class%%' )
$post_meta_remove_keys = array(
$post_meta_removes = array(
foreach ( $post_meta_removes as $mode => $post_meta_remove ) {
foreach ( $post_meta_remove_keys as $post_meta_remove_key ) {
if ( $multi_view->has_value( $post_meta_remove_key, 'on', $mode, true ) ) {
$post_meta_remove[ $post_meta_remove_key ] = $post_meta_remove_key;
$post_meta_removes[ $mode ] = implode( ',', $post_meta_remove );
$multi_view->set_custom_prop( 'post_meta_removes', $post_meta_removes );
$multi_view->set_custom_prop( 'post_content', $multi_view->get_values( 'show_content' ) );
$show_thumbnail = $multi_view->has_value( 'show_thumbnail', 'on' );
// Stash properties that will not be the same after wp_reset_query().
'current_post' => $wp_query->current_post,
'in_the_loop' => $wp_query->in_the_loop,
$show_no_results_template = true;
if ( 'off' === $use_current_loop ) {
} elseif ( is_singular() ) {
// Force an empty result set in order to avoid loops over the current post.
query_posts( array( 'post__in' => array( 0 ) ) );
$show_no_results_template = false;
// Only allow certain args when `Posts For Current Page` is set.
$original = $wp_query->query_vars;
$custom = array_intersect_key( $args, array_flip( array( 'posts_per_page', 'offset', 'paged' ) ) );
// Trick WP into reporting this query as the main query so third party filters
// that check for is_main_query() are applied.
$wp_the_query = $wp_query = new WP_Query( array_merge( $original, $custom ) );
* Filters Blog module's main query.
* @param WP_Query $wp_query
$wp_query = apply_filters( 'et_builder_blog_query', $wp_query ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- We intend to override $wp_query for blog module.
// Manually set the max_num_pages to make the `next_posts_link` work
if ( '' !== $offset_number && ! empty( $offset_number ) ) {
$wp_query->found_posts = max( 0, $wp_query->found_posts - intval( $offset_number ) );
$posts_number = intval( $posts_number );
$wp_query->max_num_pages = $posts_number > 1 ? ceil( $wp_query->found_posts / $posts_number ) : 1;
$blog_order = self::_get_index( array( self::INDEX_MODULE_ORDER, $render_slug ) );
$wp_query->et_pb_blog_query = true;
if ( 'off' === $fullwidth ) {
$attribute = et_core_is_fb_enabled() ? 'data-et-vb-columns' : 'data-columns';
echo '<div class="et_pb_salvattore_content" ' . et_core_intentionally_unescaped( $attribute, 'fixed_string' ) . '>';
ET_Post_Stack::replace( $post );
$post_format = et_pb_post_format();
$width = 'on' === $fullwidth ? 1080 : 400;
$width = (int) apply_filters( 'et_pb_blog_image_width', $width );
$height = 'on' === $fullwidth ? 675 : 250;
$height = (int) apply_filters( 'et_pb_blog_image_height', $height );
$classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
$titletext = get_the_title();
$alttext = get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true );
$thumbnail = get_thumbnail( $width, $height, $classtext, $alttext, $titletext, false, 'Blogimage' );
$thumb = $thumbnail['thumb'];
$no_thumb_class = '' === $thumb || ! $show_thumbnail ? ' et_pb_no_thumb' : '';
if ( in_array( $post_format, array( 'video', 'gallery' ) ) ) {