I now visit this page before I start any new WordPress project.
For as long as I can remember every commercial WordPress theme has had some sort of featured posts. Either in the form of a slider or a specific area of a home page. The usual method was to have a custom loop where you call either all the posts in a particular category or tagged with a particular tag. While this got the job done it is messy and required the user to remember what what special steps were needed to mark their posts are featured.
I recently read a post on the ThemeShaper blog written by the awesome Ian Stewart where he offered a different (& better) method. Ian’s method involves using a hidden custom taxonomy instead. If you follow the code in his blog post you will end up with a nice checkbox option in the backend.
After setting up the backend option all you need to do it setup a custom loop that only includes posts that are in that custom taxonomy and you have featured posts without the messiness of using tags or categories. This method also adheres to the WordPress philosophy of “Striving for Simplicity”. Also if the user switches themes there will be less unnecessary things from the previous theme under this method as well.
What do you think? Is this the way to go?
If you develop anything for WordPress this is a must view reference.
I recently read a wonderful post by Justin Tadlock where he outlined the various problems associated with going overboard with shortcodes. The biggest problem he identified was that by using a theme’s shortcodes, you are essentially locked into using one of their themes forever as once you switch themes the special formatting is gone and you are left with stray shortcodes in your posts. While you could just edit each post and remove all the stray shortcodes there has to be a better way. WordPress is loved for it ease of use and special features shouldn’t be added in a way that tarnish that reputation.
Lately I have been trying to think more long term about WordPress themes. While every theme developer wants to believe that they are going to have a customer for life it is important to think how your development decisions will affect your users in the future, especially if they switch to another theme.
Then I ran across a post by Alison Barrett who offered an alternative to shortcodes. Her idea was instead of using shortcodes in her Bolts parent theme she would add new styles to the TinyMCE styles dropdown in the visual editor. By utilizing this method while you will still lose the formatting when you switch themes the correct html will be in place and there will not be any stray shortcodes in your posts, the code will degrade gracefully.
Also in order to provide easy transferal of the css for the html code generated by the styles dropdown I would make sure to have a separate stylesheet (which Alison did) or at least a clearly marked portion of your regular stylesheet that has all the custom styles. Then when the user switches themes all they have to do is transfer over that css and all their previous formatting will be preserved.
Does this method make sense? Any other pros/cons?
Do what you love and don’t focus on money – life’s too short.
- Matt Mullenweg
Great read, makes sense when you don’t want users to lose functionality when they switch features.
Very cool use of gravity forms to allow you to generate the needed code for WordPress custom posts types.
Gridless is an awesome HTML5 and CSS3 framework for making responsive, cross-browser websites with beautiful typography.
Clear Gravity Forms Fields
Super useful jQuery code snippet that I have used a number of times.