Create a Custom Shortcode in Essential Grid

Create a shortcode using PHP and a PHP function that can read the Post ID and returns anything into the grid item.

The example below will show you how to create a shortcode that displays a date on the grid items with different date format.

1. Add the following code to your theme’s “functions.php” file.

function tp_custom_shortcode( $atts ) {
    $p = shortcode_atts( array(
        'id' => 0
    ), $atts );
//set your preferred time format
$h_time = get_post_time( 'l, F j, Y', false, $p['id'] );
return $h_time;
add_shortcode( 'custom_time_format', 'tp_custom_shortcode' );

2. Edit the grid skin and insert the shortcode into a Text/HTML layer.

[custom_time_format id=%post_id%]
Create a Custom Shortcode in Essential Grid

The Author


Strength does not come from winning. Your struggles develop your strengths. When you go through hardships and decide not to surrender, that is strength.

Liked this Post?
Please Share it!

[tp_popular title="Popular Grids" regex="(grids|template_library)" count=3]


Join over 25.000 others on the Essential Grid and Slider Revolution email list to get access to the latest news and exclusive content.