Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cool as a LOLCat: Making Custome Theme Options Easy

1,964 views

Published on

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!

Published in: Technology, Business
  • Be the first to comment

Cool as a LOLCat: Making Custome Theme Options Easy

  1. 1. COOL AS A LOLCAT Making Custom Theme Options Easy
  2. 2. Hi.
  3. 3. Who are you?‣ My name is Toby. A self-taught WordPress / PHP / Front end Developer.
  4. 4. Who are you?‣ My name is Toby. A self-taught WordPress / PHP / Front end Developer.‣ I work for Cheezburger Networks
  5. 5. CheezCAPCHEEZBURGER CUSTOM ADMINISTRATION PANEL
  6. 6. Cheezburger & WordPress
  7. 7. Farm TeamOMG MAKE LOTS OF SITES PLZ
  8. 8. Cheezburger & WordPress THEN:‣ Many self-hosted WordPress.org installations
  9. 9. Cheezburger & WordPress THEN:‣ Many self-hosted WordPress.org installations‣ Each had its own customized (read: hacked) theme.
  10. 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. 11. Cheezburger & WordPress THEN:
  12. 12. Cheezburger & WordPress THEN:
  13. 13. Cheezburger & WordPress THEN:
  14. 14. Why this was bad.‣ Spent half the time as a server admin.
  15. 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. 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. 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. 18. SOLUTION.
  19. 19. The “Unified Theme” (.com)
  20. 20. The “Unified Theme” (.com)
  21. 21. Cheezburger & WordPress NOW:‣ 10 Sites were already running a Unified Theme on WordPress.com VIP
  22. 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. 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. 24. SOLUTION.
  25. 25. CheezCAPCheezburger Custom Administration Panel
  26. 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. 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. 28. CheezCAP Getting Started‣ Edit cheezcap/config.php
  29. 29. CheezCAPGetting Started
  30. 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. 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. 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. 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. 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. 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. 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. 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. 38. CheezCAP Work For Me?How Can I Make CheezCAP‣ CheezCAP uses the WordPress options tables.
  39. 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. 40. HOLD IT! YOU SAID THERE WERE 4 FEATURES!
  41. 41. CheezCAP The Elusive 4th Feature‣ Import / Export!
  42. 42. CheezCAPThe Elusive 4th Feature
  43. 43. CheezCAPThe Elusive 4th Feature
  44. 44. CheezCAPThe Elusive 4th Feature
  45. 45. CheezCAPThe Elusive 4th Feature
  46. 46. CheezCAPThe Elusive 4th Feature
  47. 47. CheezCAPThe Elusive 4th Feature
  48. 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. 49. Thank you.
  50. 50. Thank you.@trademarkhttp://tmckes.com DOWNLOAD CHEEZCAP:toby@cheezburger.com http://chzb.gr/CheezCAPhttp://cheezburger.com

×