Wordpress shortcode for tag list

2019-06-01 07:23发布

I need to insert tags (of the post) inside post in the exact place. (default: they go after)

As I understand the only way is to use shortcode and write its description in functions. I think its an easy one including "print $tags_list", but I haven't managed to write the whole piece of code needed.
Can you help me? Or advise another way to solve my problem?
PS: Maybe another way is to insert tag code inside post, but wordpress editor doesn't understand

1条回答
唯我独甜
2楼-- · 2019-06-01 07:42

You don't really need a shortcode unless the position changes per post.

To render tags in your template (you could just move the code):

 <?php the_tags(); ?>

If you wanted to make a shortcode:

function sc_taglist(){

    return get_the_tag_list();
}
add_shortcode('tags', 'sc_taglist');

And use [tags]

查看更多
登录 后发表回答