• Save
Cool as a LOLCat: Making Custome Theme Options Easy
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Cool as a LOLCat: Making Custome Theme Options Easy

on

  • 1,797 views

One of the ways that Cheezburger has made the most out of WordPress is through custom theme options. To save ourselves time and headache, we wrote a library to make creating new options super simple. ...

One of the ways that Cheezburger has made the most out of WordPress is through custom theme options. To save ourselves time and headache, we wrote a library to make creating new options super simple. And, we've made the library publicly available to anybody who wants to use it (at http://code.google.com/p/cheezcap/). This talk will walk people through the code and how to use it to make your themes more awesome than ever!

Statistics

Views

Total Views
1,797
Views on SlideShare
1,795
Embed Views
2

Actions

Likes
1
Downloads
0
Comments
0

2 Embeds 2

http://twitter.com 1
http://paper.li 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • Released at WCPDX\n
  • Cheezburger = 400 million pageviews / month.\nLast year’s State of the Word ~10% all traffic to WordPress.com\n50 sites\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Tofulator\nIn-house theme (I think)\n
  • Kubrick\n
  • Servers constantly being hammered due to increasing traffic. Thanksgiving example.\n
  • Not using SVN or hg.\n
  • \n
  • \n
  • \n
  • GRATUITOUS ANIMATION SLIDE\n
  • \n
  • \n
  • Starting to port our WordPress.org sites over, quickly became clear that this would become tedious and tiresome.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • 5th option here, defaults to false, lets you render the text option as a text area\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Safely stored in the database. Changing your theme doesn’t make you lose anything.\n
  • Safely stored in the database. Changing your theme doesn’t make you lose anything.\n\nUser level: so only admins can change, etc. Defaults to ‘manage_options’\n
  • \n
  • My favorite feature.\n\nGoing to walk you through what this could look like.\n
  • Let’s say I already have CheezCAP in my theme. Need to move site or copy.\nExport\n
  • New site after import, using default 2010.\n
  • I enable my theme that’s using CheezCAP\n
  • Import the file.\n
  • Go from this.\n
  • To this.\n
  • \n
  • \n
  • Thanks to Matt Martz @sivel, extending and improving the code already\n

Cool as a LOLCat: Making Custome Theme Options Easy Presentation Transcript

  • 1. COOL AS A LOLCAT Making Custom Theme Options Easy
  • 2. Hi.
  • 3. Who are you?‣ My name is Toby. A self-taught WordPress / PHP / Front end Developer.
  • 4. Who are you?‣ My name is Toby. A self-taught WordPress / PHP / Front end Developer.‣ I work for Cheezburger Networks
  • 5. CheezCAPCHEEZBURGER CUSTOM ADMINISTRATION PANEL
  • 6. Cheezburger & WordPress
  • 7. Farm TeamOMG MAKE LOTS OF SITES PLZ
  • 8. Cheezburger & WordPress THEN:‣ Many self-hosted WordPress.org installations
  • 9. Cheezburger & WordPress THEN:‣ Many self-hosted WordPress.org installations‣ Each had its own customized (read: hacked) theme.
  • 10. Cheezburger & WordPress THEN:‣ Many self-hosted WordPress.org installations‣ Each has it’s own customized (read: hacked) theme.‣ Making ~2 new sites a week.
  • 11. Cheezburger & WordPress THEN:
  • 12. Cheezburger & WordPress THEN:
  • 13. Cheezburger & WordPress THEN:
  • 14. Why this was bad.‣ Spent half the time as a server admin.
  • 15. Why this was bad.‣ Spent half the time as a server admin.‣ No history or version control of the changes that were made.
  • 16. Why this was bad.‣ Spent half the time as a server admin.‣ No history or version control of the changes that were made.‣ It looked bad.
  • 17. Why this was bad.‣ Spent half the time as a server admin.‣ No history or version control of the changes that were made.‣ It looked bad.‣ Easy to make new sites, difficult to maintain and update them.
  • 18. SOLUTION.
  • 19. The “Unified Theme” (.com)
  • 20. The “Unified Theme” (.com)
  • 21. Cheezburger & WordPress NOW:‣ 10 Sites were already running a Unified Theme on WordPress.com VIP
  • 22. Cheezburger & WordPress NOW:‣ 10 Sites were already running a Unified Theme on WordPress.com VIP‣ One file contained all the customization settings for the sites.
  • 23. Cheezburger & WordPress NOW:‣ 10 Sites were already running a Unified Theme on WordPress.com VIP‣ One file contained all the customization settings for the sites.‣ PROBLEM: Creating a new site meant re-copying a bunch of code.
  • 24. SOLUTION.
  • 25. CheezCAPCheezburger Custom Administration Panel
  • 26. CheezCAPWhat is it?CheezCAP is a library thatallows you to easily createan administration panel foryour theme.There are 4 main featuresthat make CheezCAPtotally awesome.
  • 27. CheezCAP Getting Started‣ Add the folder to your theme directory‣ Add the following to your functions.php file: require_once(cheezcap/ cheezcap.php);
  • 28. CheezCAP Getting Started‣ Edit cheezcap/config.php
  • 29. CheezCAPGetting Started
  • 30. CheezCAP Getting Started‣ Once you’ve created the options you want to use, you can start adding them to your theme: if ( $cap->my_boolean_option ) { // do stuff }
  • 31. CheezCAP Boolean OptionsBoolean Options serve as basic toggleswitches:new BooleanOption( Simple Boolean Example, This will create a simple true/false switch.’, simple_boolean_example, true ),
  • 32. CheezCAP Boolean OptionsBoolean Options serve as basic toggleswitches:new BooleanOption( Simple Boolean Example, <- TitleDescription -> This will create a simple true/false switch.’, simple_boolean_example, <- ID of the parameter true <- Initial Value ),
  • 33. CheezCAP Text OptionsText Options can represent alphanumericstrings to be inserted, code, etc. new TextOption( Simple Text Exmaple #3, This will store a string value.’, simple_text_example3, Say Cheez! ),
  • 34. CheezCAP Dropdown OptionsDropdown Options serve as morecomplex switches:new DropdownOption( Inline Options Dropdown Example #3, This dropdown creates its options using an inline array., inline_options_dropdown_example3, array( Red, Yellow, Green ), 2, // Green ),
  • 35. CheezCAP Work For Me?How Can I Make CheezCAP‣ Text Options: Google Analytics accounts, site announcements, customized text in your theme ( comment links, page navigation, 404 pages )
  • 36. CheezCAP Work For Me?How Can I Make CheezCAP‣ Text Options: Google Analytics accounts, site announcements, customized text in your theme ( comment links, page navigation, 404 pages )‣ Boolean Options: Turn Features on and off, beta or A/B testing
  • 37. CheezCAP Work For Me?How Can I Make CheezCAP‣ Text Options: Google Analytics accounts, site announcements, customized text in your theme ( comment links, page navigation, 404 pages )‣ Boolean Options: Turn Features on and off, beta or A/B testing‣ Dropdown Options: switching stylesheets or color schemes, enabling or disabling sets of features, more complex logic than boolean
  • 38. CheezCAP Work For Me?How Can I Make CheezCAP‣ CheezCAP uses the WordPress options tables.
  • 39. CheezCAP Work For Me?How Can I Make CheezCAP‣ CheezCAP uses the WordPress options tables.‣ Able to specify required user permissions level to edit.
  • 40. HOLD IT! YOU SAID THERE WERE 4 FEATURES!
  • 41. CheezCAP The Elusive 4th Feature‣ Import / Export!
  • 42. CheezCAPThe Elusive 4th Feature
  • 43. CheezCAPThe Elusive 4th Feature
  • 44. CheezCAPThe Elusive 4th Feature
  • 45. CheezCAPThe Elusive 4th Feature
  • 46. CheezCAPThe Elusive 4th Feature
  • 47. CheezCAPThe Elusive 4th Feature
  • 48. CheezCAP In Summary‣ Create Text Options, Boolean Options and Dropdown Options.‣ Use them to control and modify your theme on the fly.‣ Export your settings to a text file for backup and portability.
  • 49. Thank you.
  • 50. Thank you.@trademarkhttp://tmckes.com DOWNLOAD CHEEZCAP:toby@cheezburger.com http://chzb.gr/CheezCAPhttp://cheezburger.com