Support

Account

Home Forums General Issues theme shortcodes in wysiwyg field

Solving

theme shortcodes in wysiwyg field

  • Hi!
    I’m using a custom theme and I added a wysiwyg field.
    I’ve added a shortcode inside it like this :

    [button url="http://" size="large"]asdasddsa[/button]

    and the output is the same:

    [button url="http://" size="large"]asdasddsa[/button]

    Any suggestions on how can I fix this?
    Thanks!

  • Hi @dynamyc

    What code are you using to output the WYSIWYG value on the front end?
    Also, what code are you using to register to the shortcode?

    Can you confirm the shortcode works in the normal the_content editor?

    Thanks
    E

  • The shortcode is working in the normal content editor, which is strange because some shortcodes are working inside the WYSIWYG fields.

    The code which I’m using to output the WYSIWYG value is this:
    <?php the_field('fieldname'); ?>

    I don’t know where to look to see what code I’m using for registering the shortcode, should I look in the plugin files or inside my theme files?

    Thanks!

  • Hi @dynamyc

    Could be either. Do you have a ‘button’ shortcode plugin installed? Is it part of your theme?

    Easiest way is to search your website folder for “shortcode”

    Thanks
    E

  • Yes, I have a plugin installed for shortcodes.

    What I’m more interested is to make a specific plugin shortcode to work. This is kind of urgent.

    For what I should look inside the plugin files ? Or what I need to modify in order to work?

    I see the button for it inside the WYSIWYG field but the output is like this:
    <div id="countdown-1385051206"></div>

    So is doing something but the div is empty.
    Should I ask the developer of the plugin?

  • Hi @dynamyc

    In your first comment, you say that the output is the same, as in, the shortcode is not being converted at all.

    I don’t understand the importance of this div.
    Perhaps you can ask the shortcode plugin developer as I am not sure how I can be of much help on this one.

    Thanks
    E

  • I’ve asked the plugin developer and he said that his plugin it pushes also custom styles and scripts to the header and I have to make sure that the ACF plugin pushes them.
    Do you have any idea how can I check or make the necessary scripts and plugins to be pushed inside the ACF plugin ?

  • Hi @dynamyc

    ACF does not include any 3rd party scripts or styles. This is not possible for ACF to do.

    Can you please read over my previous comment and answer the first question?

    It is important for us to clarify what is and isn’t working? Is the DOM markup being produced by your shortcode?

    Thanks
    E

  • The DOM markup is produced by the shortcode, but the scripts which should be pushed are missing and that’s why the div is empty.

  • Hi @dynamyc

    Thanks for the foolow up. This confirms that the shortcode is indded working correctly, but either the script is missing or there is a JS error on the page preventing it from working.

    Can you please open your console log and report any JS errors on the page?

    Next, can you search the source code on the page for the javascript file. Is it included at all?

    Lastly, search through the 3rd party plugin to find out how the script is included. Perhaps it is using the ‘the_content’ filter to add the script? If this is the case, then you will need to run your ACF value through this filter like so:

    
    echo apply_filters('the_content', get_field('field_name'));
    

    Thanks
    E

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘theme shortcodes in wysiwyg field’ is closed to new replies.