Technique For Creating Portable Social Menus In WordPress Themes

One of the features within the Stargazer child theme we are using on WPTavern are the social icons located at the bottom of the site. The social icons are not images but rather, Genericons. As explained by Konstantin Kovshenin, Justin Tadlock used a method to add social network icons that are portable between themes. By using a few simple CSS selectors, the social links are able to be targeted by their href attribute.

No more plugin dependencies, no more long docs of CSS class names, no more arguing with the Theme Reviewers Theme on WordPress.org that social profile icons are part of the appearance of a theme and not “plugin territory” because users can lose their content upon theme switch.

Justin Tadlock published two different posts that explain the thought process behind the technique as well as the code needed to make it work. It’s being championed by the WordPress theme community to the point of it possibly being added to the WordPress Theme Review Guidelines.

7 Comments


  1. Interesting stuff Jeff and Justin’s posts are easy to follow.
    At the momemnt I’m using the Simple Social icons plugin for my social network links.

    Thanks for sharing.

    Report


  2. For the record: while I would LOVE to see something like this as a standard implementation, we’re nowhere near adding it as a requirement to the Theme Review Guidelines.

    Report


    1. Good thing I used the word ‘possibly’ :) only a matter of time I suppose. Since you’re here, just a question I have. Is there anything within the theme review guidelines that might prevent a theme from being portable? Are there specifics on themes using Shortcodes or custom post types?

      Report


      1. Given the way things sometimes can get… taken out of context with the Theme Review Guidelines, I just wanted to clarify. It’s been mentioned on the mail-list as a good example of a best-practice implementation, but that’s it. If it gets widespread adoption, adding it to the Guidelines is a bridge that may present itself for crossing, sometime in the future. :)

        As for Theme portability: that is a very important consideration in the Guidelines. To the greatest extent possible, users should be able to switch from one Directory-hosted Theme to another with minimal impact – and with zero impact to user-generated content. So yes: the Theme Review Guidelines do prohibit Themes from including post-content shortcodes, and from registering custom post types, custom taxonomies, etc.

        The presentation-vs-functionality differentiation has been hotly contested at times, but I think we’re finally seeing inroads with both end users and developers understanding why it is best for everyone involved for Themes to keep as closely as possible to presentation, and to leave functionality to Plugins.

        Report


      2. Thanks for the clarification and insight. I would like to see you present a session on the topic of Portable Themes – Making sure end users don’t get screwed when switching themes.

        Report


Comments are closed.