ThemeShaper Forums » Thematic

Create shortcode for the default site info

(18 posts)
  • Started 5 years ago by Ian Stewart
  • Latest reply from Chris
  • This topic is resolved

Tags:

  1. Now I need help! :) Anyone know if it's possible to create shortcodes for the default footer text. What I'd like is a [wordpress-link] and [theme-credit]. And what I'd especially like is for [theme-credit] to be filterable so publicly released Child Themes can add their own credit link, like:

    [theme-credit] = Thematic and Awesome Theme

    or just

    [theme-credit] = Awesome Theme

    if they like.

    Posted 5 years ago #
  2. Gimme 10 minutes :-)

    Posted 5 years ago #
  3. It would also be great if this could be localised! Do you think it would be possible to add this to the POT and PO/MO files?

    Posted 5 years ago #
  4. Ok .. it took me 13 minutes to find it plus 5 minutes for this post but now I know how it works :-)

    function theme_credit() {
    return "Thematic and Awesome Theme";
    }
    add_shortcode('theme-credit', 'theme_credit')

    You can extend this one using an additional function for the content to make it filterable.

    And now let's bring some magic into your footer.php:

    $thm_footertext = do_shortcode($thm_footertext);

    Cheers,

    Chris

    Posted 5 years ago #
  5. Chris, you rule.

    Posted 5 years ago #
  6. Don't forget about localisation ;o)

    Posted 5 years ago #
  7. Hey Florent,

    will try my very best :-)

    Cheers,

    Chris

    Posted 5 years ago #
  8. Many thanks Chris!

    Posted 5 years ago #
  9. Sorry for this delay .. got a call from my favorite Spanish restaurant and my favorite bar this evening ;-) .. my prove of concept is ready, tested and working .. the combined magic of translation, filters and shortcodes finally works .. I will commit the final version tomorrow to the SVN

    Cheers,

    Chris

    Posted 5 years ago #
  10. I accidentally shortcodes to trunk. :( Hopefully we can merge.

    Posted 5 years ago #
  11. .. don't worry .. let me merge tomorrow (see PM and DM)

    Posted 5 years ago #
  12. .. ok .. latest and greatest revision uploaded to SVN .. Fixed a glitch in footer.php, moved the shortcodes to shortcodes.php, added the following shortcodes:

    [theme-name]
    [theme-author]
    [theme-uri]
    [theme-version]
    [child-name]
    [child-author]
    [child-uri]
    [child-version]

    Updated thematic.pot

    And did a couple of tests, that translation and shortcodes are working as expected.

    Cheers,

    Chris

    Posted 5 years ago #
  13. Chris, this one doesn't work for me and I don't know why. Here's teh generated code:

    <div id="siteinfo">
        		[wp-link] [theme-link] [loginout-link] [blog-title] [the-year]
    		<a href="http://www.altamentedecorativo.com/">Second to None Childtheme</a>
    		</div><!-- close #siteinfo -->
    Posted 5 years ago #
  14. .. will look into the code as soon as I'm back at home .. btw.: which revision are you using?

    Posted 5 years ago #
  15. sorry Chris... rev 427, the latest one...

    Posted 5 years ago #
  16. Could you please create a new post and add the shortcodes into a post? .. Need to know if this is a problem with the shortcodes or the do_shortcode() function.

    I tested everything with WP 2.7.1 and 2.8 and it works here :(

    Posted 5 years ago #
  17. Chris, I don't know why but now it works witout changes. Maybe it was a cache issue.

    Posted 5 years ago #
  18. Hey Danny,

    good to see that it's working for you.

    Cheers,

    Chris

    Posted 5 years ago #

RSS feed for this topic

Reply

You must log in to post.