Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #287764

    Hi,

    We use custom shortcodes like [image1] to show logos to companys we often write about. We need these small logos in the title on the Accordion but it dont work.

    If you just put the regular code in the title field it shows up. But if we try the shortcode [image1] that output the code it dont work.

    It removes almost the whole title and add this to the content:
    ‘ tags=”]

    Any ideas?

    We have custom fuctions in our enfold child theme like hits:

    function image1() {

    return ‘‘;

    }

    add_shortcode(‘shortcode1’, ‘image1’);

    The image shortcodes work well in other places.

    #287765

    The code what was removed looks like this::

    function image1() {
    
    return ‘<img src="URL">‘;
    
    }
    
    add_shortcode(‘shortcode1′, ‘image1′);
    #287831

    Hi!

    Thank you for using the theme.

    If I am not mistaken, you should use [shortcode1] not [image1] in order to call the shortcode function image1.

    Cheers!
    Ismael

    #287854

    Hi Ismael,

    Your right, I just wrote it wrong here in the example. We use [shortcode1] on our site.

    This shortcode works and output the image if I use it on the post or in the content bart of the accordion.

    But when I use it in the title it dont work.

    We have around 15-20 images that we use around 50-90 times every day so it saves us hours of manual work time to use these shortcodes.

    #288433

    Hi again Ismael,

    Did you find any way to be able to use shortcodes in the accordion title?

    If not, any other fast way to always insert the same images in a fast and easy way?

    #288598

    Hey!

    Accordion titles do not support shortcodes by default. If you really want to use a shortcode in the title open up wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/toggles.php and replace:

    
                if(empty($toggle_atts['title']))
                {
                    $toggle_atts['title'] = avia_sc_toggle::$counter;
                }
    

    with

    
                if(empty($toggle_atts['title']))
                {
                    $toggle_atts['title'] = avia_sc_toggle::$counter;
                }
    
                $toggle_atts['title'] = do_shortcode($toggle_atts['title']);
    

    Regards,
    Peter

    #288666
    This reply has been marked as private.
    #288667
    This reply has been marked as private.
    #288848

    Hey!

    Can you post a link to the page where you have these accordions and the image URL you want to include in the titles?

    Regards,
    Josue

    #288880
    This reply has been marked as private.
    #288882
    This reply has been marked as private.
    #289036

    Hey!

    Where have you changed the file so far? Was it in the parent or the child theme?

    Cheers!
    Devin

    #289177
    This reply has been marked as private.
    #289284

    Hey!

    Check it now:
    http://www.informatchen.se/preview/

    I was able to achieve what you want using CSS:

    .custom_title:after {
        content: url(https://www.informatchen.se/wp-content/uploads/2014/07/check341.png);
        position: relative;
        top: 2;
        right: -3;
    }

    The tab title in question is set as an span.custom_title:

    Best regards,
    Josue

    #289379
    This reply has been marked as private.
    #289494

    You can use the same css technique but with various classes if the php file change isn’t working for you. So for each image you would have a different class (which is the same way the theme does the icon fonts icons on elements).

    #293638
    This reply has been marked as private.
Viewing 17 posts - 1 through 17 (of 17 total)
  • The topic ‘Custom shortcodes in Accordion title?’ is closed to new replies.