Posts Extra Actions

Post Header

elementor_extras/widgets/posts/before_post_header

Fires right before the output of post header area.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_post_header( $settings, $post_id ) {
    echo '<div>Before Post Header</div>';
}
add_action( 'elementor_extras/widgets/posts/before_post_header', 'my_before_post_header', 10, 2);

Note: If you have changed the default order of the post areas, any output added here will not necessarily appear visually where it should as the location refers to DOM position of this area.


elementor_extras/widgets/posts/after_post_header

Fires right after the output of post header area.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_post_header( $settings, $post_id ) {
    echo '<div>After Post Header</div>';
}
add_action( 'elementor_extras/widgets/posts/after_post_header', 'my_after_post_header', 10, 2);

Note: If you have changed the default order of the post areas, any output added here will not necessarily appear visually where it should as the location refers to DOM position of this area.


Post Media

elementor_extras/widgets/posts/before_post_media

Fires right before the output of post media area.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_post_media( $settings, $post_id ) {
    echo '<div>Before Post Media</div>';
}
add_action( 'elementor_extras/widgets/posts/before_post_media', 'my_before_post_media', 10, 2);

Note: If you have changed the default order of the post areas, any output added here will not necessarily appear visually where it should as the location refers to DOM position of this area.


elementor_extras/widgets/posts/after_post_media

Fires right after the output of post media area.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_post_media( $settings, $post_id ) {
    echo '<div>After Post Media</div>';
}
add_action( 'elementor_extras/widgets/posts/after_post_media', 'my_after_post_media', 10, 2);

Note: If you have changed the default order of the post areas, any output added here will not necessarily appear visually where it should as the location refers to DOM position of this area.


Post Body

elementor_extras/widgets/posts/before_post_body

Fires right before the output of post body area.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_post_body( $settings, $post_id ) {
    echo '<div>Before Post Body</div>';
}
add_action( 'elementor_extras/widgets/posts/before_post_body', 'my_before_post_body', 10, 2);

Note: If you have changed the default order of the post areas, any output added here will not necessarily appear visually where it should as the location refers to DOM position of this area.


elementor_extras/widgets/posts/after_post_body

Fires right after the output of post body area.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_post_body( $settings, $post_id ) {
    echo '<div>After Post Body</div>';
}
add_action( 'elementor_extras/widgets/posts/after_post_body', 'my_after_post_body', 10, 2);

Note: If you have changed the default order of the post areas, any output added here will not necessarily appear visually where it should as the location refers to DOM position of this area.


Post Footer

elementor_extras/widgets/posts/before_post_footer

Fires right before the output of post footer area.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_post_footer( $settings, $post_id ) {
    echo '<div>Before Post Footer</div>';
}
add_action( 'elementor_extras/widgets/posts/before_post_footer', 'my_before_post_footer', 10, 2);

Note: If you have changed the default order of the post areas, any output added here will not necessarily appear visually where it should as the location refers to DOM position of this area.


elementor_extras/widgets/posts/after_post_footer

Fires right after the output of post footer area.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_post_footer( $settings, $post_id ) {
    echo '<div>After Post Footer</div>';
}
add_action( 'elementor_extras/widgets/posts/after_post_footer', 'my_after_post_footer', 10, 2);

Note: If you have changed the default order of the post areas, any output added here will not necessarily appear visually where it should as the location refers to DOM position of this area.


Content Parts, Areas & Metas

The following actions contain references to the widgets content parts, areas and metas. These components are explained in depth in the Posts Extra documentation page.

Available components

TypeNameAppears in
AreaHeaderPost Container
AreaMediaPost Container
AreaBodyPost Container
AreaFooterPost Container
Content PartTermsPost Area
Content PartTitlePost Area
Content PartExcerptPost Area
Content PartButtonPost Area
Content PartMetasPost Area
MetaAuthorMetas Content Part
MetaDateMetas Content Part
MetaCommentsMetas Content Part
MetaPriceMetas Content Part

elementor_extras/widgets/posts/after_{$area}_start

Fires right after the output of a post area container starting html tag. The {$area} part refers to the area of the post (header, media, body, footer).

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_media_start( $settings, $post_id ) {
    echo '<div>After Media Start Tag</div>';
}
add_action( 'elementor_extras/widgets/posts/after_media_start', 'my_after_media_start', 10, 2);

elementor_extras/widgets/posts/before_{$area}_end

Fires right before the output of a post area container ending html tag. The {$area} part refers to the area of the post (header, media, body, footer).

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_media_end( $settings, $post_id ) {
    echo '<div>Before Media End Tag</div>';
}
add_action( 'elementor_extras/widgets/posts/before_media_end', 'my_before_media_end', 10, 2);

elementor_extras/widgets/posts/before_{$area}_{$part}

Fires right before the output of a post content part belonging to a post area. The {$area} refers to the area of the post (header, media, body, footer) and
{$part} refers to one of the post content parts (terms, title, excerpt, button, metas).

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_header_terms( $settings, $post_id ) {
    echo '<div>Before Header Terms</div>';
}
add_action( 'elementor_extras/widgets/posts/before_header_terms', 'my_before_header_terms', 10, 2);

The example above will print Before Header Terms immediately after the terms if they are located in the Header of the post.


elementor_extras/widgets/posts/after_{$area}_{$part}

Fires right after the output of a post content part belonging to a post area. The {$area} refers to the area of the post (header, media, body, footer) and
{$part} refers to one of the post content parts (terms, title, excerpt, button, metas).

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_body_excerpt( $settings, $post_id ) {
    echo '<div>After Body Excerpt</div>';
}
add_action( 'elementor_extras/widgets/posts/after_body_excerpt', 'my_after_body_excerpt', 10, 2);

The example above will print After Body Excerpt immediately after the excerpt if the excerpt is located in the Body of the post.


elementor_extras/widgets/posts/before_{$area}_metas

Fires before the output of the first meta in the area. Any outputted content should be wrapped in <li></li> tags. The {$area} part refers to the area of the post (header, media, body or footer).

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function inject_custom_field( $settings, $post_id ) {
    $custom_field = get_field( 'my_custom_field', $post_id );
    if ( $custom_field ) { 
        printf( '<li>%s</li>', $custom_field );
    }
}
add_action( 'elementor_extras/widgets/posts/before_body_metas', 'inject_custom_field', 10, 2);

This examples adds the value of an ACF custom field to the beginning of the metas list located in the body of the post. Notice we are wrapping the value of the custom field in LI tags. This is important because all metas are list items and not doing so will result in invalid HTML.


elementor_extras/widgets/posts/after_{$area}_metas

Fires after the output of the last meta in the area. Any outputted content should be wrapped in <li></li> tags. The {$area} part refers to the area of the post (header, media, body or footer).

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function inject_post_meta( $settings, $post_id ) {
    $post_meta = get_post_meta( $post_id, 'post_meta_key' );
    if ( $post_meta ) { 
        printf( '<li>%s</li>', $post_meta );
    }
}
add_action( 'elementor_extras/widgets/posts/after_footer_metas', 'inject_custom_field', 10, 2);

This examples adds the value of a post meta to the end of the metas list located in the footer of the post. Notice we are wrapping the value of the custom field in LI tags. This is important because all metas are list items and not doing so will result in invalid HTML.


elementor_extras/widgets/posts/before_{$meta}

Fires right before the output of a post meta. The {$meta} part refers to the meta of the post (author, date, comments or price).

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID
$areastringWhere the meta is located. Can be ‘header’, ‘media’, ‘body’ or ‘footer’.

Example usage

function inject_post_meta( $settings, $post_id, $area ) {
    $post_meta = get_post_meta( $post_id, 'post_meta_key' );
    if ( $post_meta ) { 
        printf( '<li>%s</li>', $post_meta );
    }
}
add_action( 'elementor_extras/widgets/posts/before_comments', 'inject_post_meta', 10, 3);

This examples adds the value of a post meta in the metas list right before the comments meta is printed. Notice we are wrapping the value of the custom field in LI tags. This is important because all metas are list items and not doing so will result in invalid HTML.


elementor_extras/widgets/posts/after_{$meta}

Fires right after the output of a post meta. The {$meta} part refers to the meta of the post (author, date, comments or price).

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID
$areastringWhere the meta is located. Can be ‘header’, ‘media’, ‘body’ or ‘footer’.

Example usage

function inject_post_meta( $settings, $post_id, $area ) {
    $post_meta = get_post_meta( $post_id, 'post_meta_key' );
    if ( $post_meta ) { 
        printf( '<li>%s</li>', $post_meta );
    }
}
add_action( 'elementor_extras/widgets/posts/after_author', 'inject_post_meta', 10, 3);

This examples adds the value of a post meta in the metas list right after the author meta is printed. Notice we are wrapping the value of the custom field in LI tags. This is important because all metas are list items and not doing so will result in invalid HTML.


Loop and items

elementor_extras/widgets/posts/before_loop

Fires right before the loop starts.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_loop( $settings, $post_id ) {
    echo '<div>Before Loop</div>';
}
add_action( 'elementor_extras/widgets/posts/before_loop', 'my_before_loop', 10, 2);

elementor_extras/widgets/posts/after_loop

Fires right after the loop ends.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_loop( $settings, $post_id ) {
    echo '<div>After Loop</div>';
}
add_action( 'elementor_extras/widgets/posts/after_loop', 'my_after_loop', 10, 2);

elementor_extras/widgets/posts/before_grid_item

Fires right before the output of the grid item container.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_grid_item( $settings, $post_id ) {
    echo '<div>Before Grid Item</div>';
}
add_action( 'elementor_extras/widgets/posts/before_grid_item', 'my_before_grid_item', 10, 2);

elementor_extras/widgets/posts/after_grid_item

Fires right after the output of the grid item container.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_grid_item( $settings, $post_id ) {
    echo '<div>After Grid Item</div>';
}
add_action( 'elementor_extras/widgets/posts/after_grid_item', 'my_after_grid_item', 10, 2);

elementor_extras/widgets/posts/after_grid_item_start

Fires right after the output of the grid item container starting html tag.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_after_grid_item_start( $settings, $post_id ) {
    echo '<div>After Grid Item Start</div>';
}
add_action( 'elementor_extras/widgets/posts/after_grid_item_start', 'my_after_grid_item_start', 10, 2);

elementor_extras/widgets/posts/before_grid_item_end

Fires right before the output of the grid item container ending html tag.

Parameters

ParamTypeDescription
$settingsArrayThe current widget settings
$post_idIntThe post ID

Example usage

function my_before_grid_item_end( $settings, $post_id ) {
    echo '<div>Before Grid Item End</div>';
}
add_action( 'elementor_extras/widgets/posts/before_grid_item_end', 'my_before_grid_item_end', 10, 2);
Days
Hours
Minutes
Seconds
Sale Over