• I would like to be able to call shortcodes from another plugin but I can’t seem to get the code right.

    I can enter plain text in the custom field and get it to display with each image. This means I have your code implemented correctly.

    Now, I want to enter a shortcode [add_to_cart item=”000″] which will display an Add to Cart button that when clicked, will place the image into a shopping cart. I tried to use this code: <?php echo do_shortcode(‘[add_to_cart item=”000″]’); ?> and this code [add_to_cart item=”000″] …but neither worked. Any ideas?

Viewing 1 replies (of 1 total)
  • Plugin Author shauno

    (@shauno)

    Hey

    If you are using <?php echo $image->ngg_custom_fields["Your Field Name Here"]; ?> to display the custom field already, this should work:

    <?php echo do_shortcode($image->ngg_custom_fields["Your Field Name Here"]); ?> Where “Your Field Name Here” is obviously the name of the field you have the shortcode in.

    It’s weird that calling do_shortcode() directly like you said you were isn’t working.

    I hope you are enjoying the plugin, let me know how it goes ??

Viewing 1 replies (of 1 total)
  • The topic ‘Use shortcodes in the custom field’ is closed to new replies.