Shortcodes in Info Boxes

This support request was posted in Flatbase by trucallinglife

Request ID #7190 In Progress
  • trucallinglife

    How do I inject a short code in to the Info Boxes, I’m able to do it with posts and pages on the site but for some reason it doesn’t work when I put it in an Info Box. My assumption would be the Info Box’s weren’t given the code to parse a short code but it’s one of the easiest ways to get around missing functionality.

    I would assume it’s a relatively straight forward bit of code to add the functionality to the Info Box’s but without knowing a how they are built it’s quite difficult to work out how or where.

    Juanfra Aldasoro

    Hi,

    Thank you for writing, I hope you are doing well.

    The reason why you are not seeing your shortcodes applied in your info boxes text is that the info boxes use a function named get_the_excerpt() to check and see if there’s actually text. That function is part of WordPress and by default it doesn’t allow shortcodes.

    However, you can add this simple snippet (to the functions.php file) I’ve created and you should be able to see your shortcodes work in your infoboxes: https://gist.github.com/juanfra/e3868f044d5c09ff11f8ccc0502b9f20

    Best,
    Juan.

    trucallinglife

    That’s incredibly helpful thank you, one quick question though is what file would I paste that in, I’m happy doing some basic editing of PHP I usually just find it a challenge identifying ‘where’ as in which file.

    Juanfra Aldasoro

    Hi,

    Thank you for the follow up.

    You need to paste that code in the functions.php of your theme.

    Best,
    Juan

    trucallinglife

    Hmm, I’ve tried that but it doesn’t seem to work. I know the short code works as I’ve tested it in normal pages and in a Flatbase Article and both work fine. However when I edit the “functions.php” in the Flatbase template nothing changes, I’ve tried combinations of editing the Flatbase functions file, editing the core WordPress functions file and tried with the shortcode in both the Flatbase shortcode file and the core WordPress shortcode file.

    https://www.dropbox.com/sh/pvaewxi87fa0jwd/AADoiVFkpbz3XetqBrOJ-P2Ia?dl=0

    Juanfra Aldasoro

    Hi,

    Thank you for the follow up. If you check the code I’ve sent you the hook is over get_the_excerpt and you are doing it over the_excerpt, please try changing that.

    Best,
    Juan.

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

You must be logged in to reply to this topic.

Login to your Account

Welcome back! Please log in to your account by filling the fields below:

Forgot?

Not a member? Create a free account.

Create a Free Account

You're 27 seconds away from some awesome WordPress free stuff, benefits and more. Create a free account and have access to our free products, benefits and more!

Already have an account? Log in
Secure Server