WordPress.org

Forums

Allow do_shortcode for value/output of custom feild type (1 post)

  1. spyhunterx
    Member
    Posted 1 year ago #

    Hi guys,

    I would most certainly appreciate your replies and solutions to this matter.

    I'm using the ACF plugin and Jigoshop for this development.

    With ACF, I have created a series of 3 check boxes for the option page of a particular custom post type. These 3 check boxes are actually a list of shortcodes generated by Jigashop, for particular products.

    As ACF is designed, each check box created should consist of a value.
    One of the check box's for my custom field is assigned as "red". ex:red:[product id="181"], where red registers as a key or label name and its' value is [product id="181"].

    As you guys can see, my value for red is actually a shortcode; [product id="181"].

    My goal is when red is chosen, its' field output which is [product id="181"] should be echoed in it's suppose form; a product item, not text.

    I tried doing this:
    testtest is the field name created through ACF

    <?php
    $value = html_entity_decode(get_field('testtest'));
    $output = do_shortcode($value);
    echo $output;
    ?>

    But the output is blank.

    I've tried stripping out "html_entity_decode", but then the term "Array" was echoed out instead.

    I've then tried using "the_field", but this time the shortcode was echoed as text "[product id="181"]", even after adding "html_entity_decode".

    Can someone please tell me what I'm doing wrong? I just want to output the shortcode selected by admin (through the check boxes created) in it's supposed form, not text. I'm basically trying to convert the output/value of the selected checkbox, to a shortcode.

    Will greatly appreciate your help and responses.

    [Moderator Note: No bumping. If it's that urgent, consider hiring someone instead.]

Topic Closed

This topic has been closed to new replies.

About this Topic