• Hi Saravana
    first of all – thank you for this excellent plugin!
    I would like to enter a shortcode into a readonly admin field and have it rendered on the product page. Is there a way to do this? I would greatly appreciate your input. Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Saravana Kumar K

    (@mycholan)

    Hi,

    All admin fields are stored as Post Meta only so a simple get_post_meta(); is enough

    $af_val = get_post_meta( $post_id, "wccaf_" . "your field name", true );
    echo do_shortcode( $af_val );

    Note:
    All admin fields key will have “wccaf_” as prefix.

    Regards
    Sark

    Thread Starter cleanteam

    (@cleanteam)

    thanks Sark
    I think I have not been precise in my question. So what I like to do is to enter a shortcode as a predefined value in the admin field and have this shortcode rendered to its output in this same field on the product page. I am trying to get a value into the field that is only created on the product page (such as e.g. the username).

    I can use this

    $af_val = get_post_meta( $post->ID, "wccaf_" . "your field name", true );
    echo do_shortcode( $af_val );

    to render the shortcode somewhere on the page, but that’s not exactly what I am trying to achieve.
    Hope I made myself clear 🙂
    thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘render shortcode in field?’ is closed to new replies.