Shortcodes not working properly

Home Forums Using Thematic Child Themes Build Your Own Custom Child Themes Shortcodes not working properly

This topic is: resolved

This topic contains 15 replies, has 3 voices, and was last updated by  bogh 5 years, 2 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #987

    bogh
    Participant

    Hi,

    In my child theme’s option panel I use something like that:

    
    &amp;lt;h2&amp;gt;&amp;lt;a href=&quot;&amp;lt;?php echo TEMPLATEURI; ?&amp;gt;&quot; target=&quot;_blank&quot;&amp;gt;&amp;lt;?php echo TEMPLATENAME; ?&amp;gt; Theme&amp;lt;/a&amp;gt; v.&amp;lt;?php echo TEMPLATEVERSION; ?&amp;gt;, built on the &amp;lt;a href=&quot;<a href="http://themeshaper.com/thematic/&#038;quot" rel="nofollow">http://themeshaper.com/thematic/&#038;quot</a>; target=&quot;_blank&quot;&amp;gt;&amp;lt;?php echo THEMENAME; ?&amp;gt; Theme Framework&amp;lt;/a&amp;gt;.&amp;lt;/h2&amp;gt;
    
    

    The shortcodes : TEMPLATEURI, TEMPLATENAME, TEMPLATEVERSION, THEMENAME are not working properly after I upgraded Thematic and WP to the latest version yesterday.

    TEMPLATEURI – is not displaying any link anymore

    TEMPLATENAME – is displaying direct link to my child theme’s style.css, instead of displaying the name of my child theme like it used to do before.

    THEMENAME – is displaying direct link to my Thematic’s style.css, instead of displaying the name “Thematic” as it used to do before.

    TEMPLATEVERSION – is displaying “unknown” instead of displaying the correct version of my child theme.

     

    In the readme file from Thematic I see: Changed: All of the functions in shortcodes.php to namspace with <code>thematic_*</code>

     

    Does anyone else have experienced that?

    Any ideas on what I can do to fix that?

     

    Thank you.

     

    #988

    helgatheviking
    Moderator

    those aren’t shortcodes.  shortcodes always appear between brackets.

    [shortcode]

    some of the available ones are [child-name]  [child-uri] [theme-uri] etc.

    #990

    bogh
    Participant

    Thanks, I didn’t really knew how to call them, so I have called them “shortcodes”.

    Each of the “shortcodes” I have mentioned belong to a [shortcode] in shortcodes.php, so I have replaced them with do_shortcode(‘[shortcode]’) . But the issues are the same.

    Any ideas why this would happen?

    #992

    helgatheviking
    Moderator

    don’t put PHP in the options panel.  just write the shortcodes.

     

    #995

    Gene (emhr)
    Keymaster

    bogh,

    Helga was correct those ae not shortcodes. They are constants.

    There is a 1.0.2 bug that is affecting those constants. It will be resolved in an upcoming release but due to namespacing issues the constants:

    TEMPLATEURI
    TEMPLATENAME
    TEMPLATEVERSION
    THEMENAME
    THEMENAME
    THEMEAUTHOR
    THEMEURI
    THEMEURI

    will no longer used in Thematic.

    Using a constant as an argument to the do_shortcode function as you did in the above example will likely not do anything at all much less what you intend it to do.

    It may be helpful for you to learn the difference between PHP constants and WordPress Shortcodes.

    I’ll see if I can put together something for your child theme to use in substitution for those constants.

    #996

    helgatheviking
    Moderator

    if you are filling out the footer text theme options, what about this:

    <h2><a href=”[child-uri]” target=”_blank”>[child-name] Theme</a> v.[child-version], built on the [theme-link].</h2>
    #997

    bogh
    Participant

    Thank you both for your answers.

    I am sorry for not making myself unclear, I am actually not using the shortcodes in the Thematic’s Theme Options, I am using them in Thematic Options Panel v.2.2 from wptheming.com , so that code is in a PHP file, I need them to write something on the OP’s header.

    Helga please try to add the HTML you wrote into Thematic’s Theme Options > footer text. I have tried it with “thematicsamplechildtheme” and I still get version “unknown” and other issues with the other shortcodes you wrote.

    [theme-link] is the only working properly.

    #998

    bogh
    Participant

    None of the shortcodes that are using the constants mentioned by @Gene are not working properly.

    
    /**
    * Display the name of the parent theme.
    */
    function thematic_shortcode_theme_name() {
    return THEMENAME;
    }
    add_shortcode(‘theme-name’, ‘thematic_shortcode_theme_name’);
    
    /**
    * Display the name of the parent theme author.
    */
    function thematic_shortcode_theme_author() {
    return THEMEAUTHOR;
    }
    add_shortcode(‘theme-author’, ‘thematic_shortcode_theme_author’);
    
    /**
    * Display the URI of the parent theme.
    */
    function thematic_shortcode_theme_uri() {
    return THEMEURI;
    }
    add_shortcode(‘theme-uri’, ‘thematic_shortcode_theme_uri’);
    
    /**
    * Display the version no. of the parent theme.
    */
    function thematic_shortcode_theme_version() {
    return THEMATICVERSION;
    }
    add_shortcode(‘theme-version’, ‘thematic_shortcode_theme_version’);
    
    /**
    * Display the name of the child theme.
    */
    function thematic_shortcode_child_name() {
    return TEMPLATENAME;
    }
    add_shortcode(‘child-name’, ‘thematic_shortcode_child_name’);
    
    /**
    * Display the name of the child theme author.
    */
    function thematic_shortcode_child_author() {
    return TEMPLATEAUTHOR;
    }
    add_shortcode(‘child-author’, ‘thematic_shortcode_child_author’);
    
    /**
    * Display the URI of the child theme.
    */
    function thematic_shortcode_child_uri() {
    return TEMPLATEURI;
    }
    add_shortcode(‘child-uri’, ‘thematic_shortcode_child_uri’);
    
    /**
    * Display the version no. of the child theme.
    *
    */
    function thematic_shortcode_child_version() {
    return TEMPLATEVERSION;
    }
    add_shortcode(‘child-version’, ‘thematic_shortcode_child_version’);
    
    
    #999

    helgatheviking
    Moderator

    is devin’s Thematic Options Panel up to date at all?  i know he’s mostly focusing on his options framework.

    anyway, i’ll take your word that the shortcodes aren’t working properly.  i’m on my linux box and it isn’t set up yet for my local wp install.  i can only presume it has to do w/ the bug gene seems to be aware of.

    #1000

    Gene (emhr)
    Keymaster

    Yep, the constants I mentioned are not working properly in the current version of Thematic. Apologies all around for that. As a result shortcodes that use those constants are not going to work. That is the current situation.

    Bogh – your best bet maybe to set your own constants and use them in the meantime.

    Sorry but the earliest that an official update will get released is next week. I’ll try & report back tomorrow with a temporary fix.

    #1001

    bogh
    Participant

    Ok, I see.

    Is possible that you know with what I can replace [child-uri] , [child-version], [child-name]?, or at least you think they can be exchanged with something else?

    P.S. Do you know when the next upgrade will be released? 😀

    Thank you.

    #1002

    bogh
    Participant

    I have found some answers here: http://codex.wordpress.org/Function_Reference/wp_get_theme

    Please let me know if you think that there could be better solutions.

    #1003

    helgatheviking
    Moderator

    i think wp_get_theme is definitely the answer.  i’m sure that is what we’ll be using to make the fixes on our end.  as gene mentioned, earliest update would be this week.

    #1004

    bogh
    Participant

    Nice 🙂  Than case solved.

    Thank you for your help and for Thematic, you all do a good job.

    #1150

    Gene (emhr)
    Keymaster

    Hi,

    The bug in 1.0.2 that affects the shortcodes and constants has been resolved in an approved release that can be downloaded here.

    http://wordpress.org/extend/themes/download/thematic.1.0.2.1.zip

    Unfortunately until the approved theme is synced to extend it will not appear in the WordPress theme auto-upgrader on your install so downloading and upgrading Thematic is the only way to get the latest version at the moment.

    Note that the constants have been renamed to correct name-spacing requirements. Also note that the renamed constants will be removed from Thematic in the next release in favor of functions.

Viewing 15 posts - 1 through 15 (of 16 total)

The topic ‘Shortcodes not working properly’ is closed to new replies.