So I’ve been using DIVI theme (by Elegant Themes) for quite a while and I needed to find a way to add the post’s tags inside the post’s body. Since Divi doesn’t have this module I had to make my own shortcode.

As we can see in the WordPress Codex the function that returns the tag list we want is get_the_tag_list().

Usage

<?php $tag_list = get_the_tag_list( $before, $sep, $after, $id ); ?>

This function does not display anything – if you want to put it straight onto the page, you should use echo get_the_tag_list();.

Alternatively, you can assign it to a variable for further use by using $foo = get_the_tag_list();.

The variables are all optional. You can use HTML inside each of the fields.

Parameters

$before
(string) (optional) Leading text.
Default: ‘ ‘

$sep
(string) (optional) String to separate tags.
Default: ‘ ‘

$after
(string) (optional) Trailing text.
Default: ‘ ‘

$id
(integer) (optional) Post ID.
Default: Current post ID

Create your own shortcode

Just add the following code in your theme’s functions.php file:

function wp_divi_tags() {

return get_the_tag_list(‘<p>Tags: ‘,’, ‘,'</p>’);
}
add_shortcode(‘tags’, ‘wp_divi_tags’);

Then just use the SHORTCODE  anywhere you want.