Turn a snippet of HTML and PHP into a shortcode
When you want to turn a snippet into a shortcode, you have to return a string. You cannot use echo or print anything in any other way. Also, always escape your data, and check if there are actually values. I have used the HEREDOC syntax here, because it is easy to read: add_shortcode( ‘taobao’, ‘taobao_shortcode’ … Read more