Shortcode rendering as text not as shortcode should

前端 未结 3 1213
渐次进展
渐次进展 2021-01-25 09:53

I am building a shopping website and I am trying to put a shortcode in that will show the customer a buy button and the quantity of the product the customer wants to purchase. O

3条回答
  •  一整个雨季
    2021-01-25 10:36

    Try using single quotes in the do_shortcode call, like so:

     echo do_shortcode('$my_textbox_value');
    

    More likely though is that the shortcode isn't defined on the archive page so you'd need to look at where it is being instantiated to see if that is the issue. Normally when a shortcode just echoes out the content it means that shortcode doesn't exist. You can test easily enough by using the shortcode_exists() function:

     
    

    If that doesn't work then you know the issue is with the shortcode not being registered on your archives page. If it does work then you know it's something with the format of the content being passed to the shortcode.

提交回复
热议问题