WordPress.org

Ready to get started?Download WordPress

Forums

Simple Fields
[resolved] Shortcodes are not executing in the simple field text box (3 posts)

  1. Sudhanshu Dubey
    Member
    Posted 1 year ago #

    Hello,
    I was about to execute a short code inside simple field text box ,but unfortunately its not being executed just printing the same as it is written in the text field ..Like I have made a shortcode for displaying some HTML and gave a name named as [caption]..when I write [caption]n in the text field its not showing the HTML part but if I put it in editor it works!

    Here is the code I am about to use
    <div class="box_wrap clearfix">
    <div class="heading">Call to Action</div>
    <div class="box">
     
    </div>
    </div>

    In short how to run short code inside text field of Simple field WordPress plugin
    Any Idea how to resolve this...

    Thanks!

    http://wordpress.org/extend/plugins/simple-fields/

  2. Pär Thernström
    Member
    Plugin Author

    Posted 1 year ago #

    try something like this

    $your_text = apply_filters("the_content", $your_text);
  3. cokeyblokey
    Member
    Posted 11 months ago #

    Thanks Pär. I too was having the same problem trying to get a shortcode to execute from a Simple Field. Although it took me a little while to work it out (I'm a PHP novice), your suggestion got it working.

    For anyone wanting to do the same, here's an example of what you need in your template file:

    <?php
    $your_text = simple_fields_value("field_slug_goes_here");
    $your_text = apply_filters("the_content", $your_text);
    ?>
    
    <?php echo $your_text ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.