WordPress.org

Support

Support » Plugins and Hacks » Advanced Custom Fields » [Plugin: Advanced Custom Fields] How to add SHORTCODE to a PHP Custom Field

[Plugin: Advanced Custom Fields] How to add SHORTCODE to a PHP Custom Field

Viewing 1 replies (of 1 total)
  • Ok to all the useless help i got, from thousands of people that must have clicked on this and decided to not even bother, I have found the solution and will share it to be remembered as someone who actually helps and supports DIY aswell as WordPress Fanatics!

    <?php $var = get_post_meta($post->ID, 'CUSTOM FIELD NAME', true); if ($var == '') { } else { echo do_shortcode( '[open your short code]' . $var . '[/close your short code]'); } ?>
    Now like i said, i was trying to apply a shortcode through a php file, using <?php echo do_shortcode("[Shortcode]"); ?>
    Didn’t seem to work, as it didnt allow me to do add my <?php the_field('model_#'); ?> between opening and closing shortcodes, it would break. Obviously i was doing it wrong!

    After hundreds of Re-Worded Google Search Queries I found it and
    Used it as a guide to my solution/example code. But seem to have asked a similar/same question just worded differently.

    http://wordpress.org/support/topic/add-custom-field-within-shortcode-using-do_shortcode?replies=6

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Advanced Custom Fields] How to add SHORTCODE to a PHP Custom Field’ is closed to new replies.
Skip to toolbar