Custom Fields
Re-Envisioned
Support General How to output a shortcode?

  • Creator
    Topic
  • #27222
    Resolved Kara
    Participant

    Hi there - I'm starting a new thread since other was marked as solved without detailing how.

    I need to add a shortcode to a CPT in the backend using a custom field that will then show on the front end. Is this possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #27226
    Long Nguyen
    Moderator

    Hi,

    Thank you for reaching out.

    Please follow this documentation to know how to use the shortcode [ rwmb_meta ]
    https://docs.metabox.io/shortcode/

    #27237
    Kara
    Participant

    Hi Long - thanks for your quick response.

    Let me clarify - I don't want to create a shortcode of the Meta Box custom field, I need to add an existing shortcode from another plugin (in this case to show a registration form on the front end).

    Here's my workflow:
    Create CPT > Add custom field for shortcode > copy/paste registration form shortcode into custom field > registration form is visible on the front end.

    If it matters, I'll be using Elementor to pull the custom fields to a template for the CPT.

    Maybe there is a function I can add to my theme file to let me add shortcodes to the custom HTML field?

    #27252
    Long Nguyen
    Moderator

    Hi,

    Thank you for your additional information.

    If you want to insert a shortcode from another plugin, you can just use the widget Shortcode of Elementor to insert it, no need to insert via a custom field.

    Or you can insert a shortcode via the field type WYSIWYG https://docs.metabox.io/fields/wysiwyg/

    #30904
    Astwert
    Participant

    Hello Long.

    I inserted in WYSIWYG-Field a shortcode from Plugin "Content Blocks (Custom Post Widget)".

    But if i use rwmb_meta("acf-single-prod-summary-prolog") it outputs only the string of shortcode like this: [content_block slug=s-prod-summary-prolog-3dportrait]

    I came from "acf", it had always worked there.

    Hope there is a solution.

    Thank you in advance

    André

    #30906
    Astwert
    Participant

    I've now noticed that there is a need to run an extra line of code.

    echo do_shortcode( wpautop( $value ) )

    I work with Oxygenbuilder's repeater element.
    I have no way of executing this code in it.
    Is there a way i can basically define the output as rendered, or do you have another idea?

    Thank you in advance

    André

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.