advanced thesis techniques and tricks

27
Advanced Thesis Advanced Thesis Techniques and Tricks Techniques and Tricks Brad Williams WebDevStudios.com

Upload: brad-williams

Post on 17-May-2015

8.915 views

Category:

Technology


3 download

DESCRIPTION

My presentation at WordCamp Mid-Atlantic on Advanced Thesis Techniques and Tricks

TRANSCRIPT

Page 1: Advanced Thesis Techniques and Tricks

Advanced Thesis Advanced Thesis Techniques and TricksTechniques and Tricks

Brad WilliamsWebDevStudios.com

Page 2: Advanced Thesis Techniques and Tricks

Brad WilliamsCEO & Co-Founder, WebDevStudios.com

Co-Host SitePoint Podcast

Organizer NJ WordPress Meetup

Who Am I?Who Am I?

Recent Thesis Sites:

AwayToGarden.com (WPMU)LoomisCreek.comTheSisterProject.com (WPMU)MattBites.comRetroRenovation.com

Page 3: Advanced Thesis Techniques and Tricks

What is Thesis? What is a Hook Custom Page Templates Adding a Secondary Menu Widetize your Multimedia Box And more!

TopicsTopics

Page 4: Advanced Thesis Techniques and Tricks

What is Thesis?

Page 5: Advanced Thesis Techniques and Tricks

Search Engine Optimization (SEO) Accessibility Usability Flexibility

Thesis is a Premium Theme Thesis is a Premium Theme Framework with a focus on…Framework with a focus on…

Thesis was created by this guy: Chris Pearson

Page 6: Advanced Thesis Techniques and Tricks

Matt Cutts - http://www.dullest.com/blog/ Chris Brogan - http://www.chrisbrogan.com/ Copy Blogger - http://www.copyblogger.com/ Danny Sullivan - http://daggle.com/ Laughing Squid - http://laughingsquid.com/ Cute Overload - http://cuteoverload.com/ Technosailor - http://technosailor.com/ Etc, etc, etc

Who uses Thesis?Who uses Thesis?

Page 7: Advanced Thesis Techniques and Tricks

Custom_functions.php – location for all custom code, hooks, functions, etc

Custom.css – location for all custom style elements on your website

Thesis customization is Thesis customization is powered by two filespowered by two files

wp-content/themes/thesis/custom/ custom_functions.php custom.css

Location:

Page 8: Advanced Thesis Techniques and Tricks

What is a Hook?

Page 9: Advanced Thesis Techniques and Tricks

What is a Hook?

Page 10: Advanced Thesis Techniques and Tricks

Thesis features a simple hook system that is essentially an API—a set of basic commands that you can use to add to, subtract from, and modify the functionality of your Thesis installation.

Two step process:

1. construct a simple function to house your custom code2. Tell Thesis where to place your custom code by specifying the appropriate hook

You can add and remove any functions using add_action() and remove_action()

Page 11: Advanced Thesis Techniques and Tricks

Available Thesis Hooks

thesis_hook_before_htmlthesis_hook_after_htmlthesis_hook_before_headerthesis_hook_after_headerthesis_hook_headerthesis_hook_before_titlethesis_hook_after_titlethesis_hook_before_content_boxthesis_hook_after_content_boxthesis_hook_before_contentthesis_hook_after_contentthesis_hook_feature_boxthesis_hook_before_post_boxthesis_hook_after_post_boxthesis_hook_before_teasers_boxthesis_hook_after_teasers_boxthesis_hook_before_postthesis_hook_after_postthesis_hook_before_teaser_boxthesis_hook_after_teaser_boxthesis_hook_before_teaserthesis_hook_after_teaserthesis_hook_before_headlinethesis_hook_after_headline

thesis_hook_before_teaser_headlinethesis_hook_after_teaser_headlinethesis_hook_byline_itemthesis_hook_before_comment_metathesis_hook_after_comment_metathesis_hook_after_commentthesis_hook_comment_formthesis_hook_archives_templatethesis_hook_custom_templatethesis_hook_faux_adminthesis_hook_archive_infothesis_hook_404_titlethesis_hook_404_contentthesis_hook_before_sidebarsthesis_hook_after_sidebarsthesis_hook_multimedia_boxthesis_hook_after_multimedia_boxthesis_hook_before_sidebar_1thesis_hook_after_sidebar_1thesis_hook_before_sidebar_2thesis_hook_after_sidebar_2thesis_hook_before_footerthesis_hook_after_footerthesis_hook_footer

Page 12: Advanced Thesis Techniques and Tricks

48 Hooks

(In case you were counting)

Page 13: Advanced Thesis Techniques and Tricks

Example 1: Hello WordCamp

<?php

add_action('hook_name', ‘hello_wordcamp');

Function hello_wordcamp() { echo “Hello WordCamp!”;}

?>

Page 14: Advanced Thesis Techniques and Tricks

Example 2: Custom Footer

<?php

remove_action('thesis_hook_footer', 'thesis_attribution');add_action('thesis_hook_footer', 'my_footer');

function my_footer() {    echo “<p>Copyright &copy; WebDevStudios.com</p>“;}?>

Page 15: Advanced Thesis Techniques and Tricks

Now for the fun stuffNow for the fun stuff

Page 16: Advanced Thesis Techniques and Tricks

Example 3: Custom Page Template

<?php

remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');add_action('thesis_hook_custom_template', 'home_custom');

?>

Remember to set the page template to Custom Template

Page 17: Advanced Thesis Techniques and Tricks

Example 4: Add A Secondary Menu

Thesis by default has a single menu

So lets create a secondary menu!

Page 18: Advanced Thesis Techniques and Tricks

Example 4: Add A Secondary Menu

<?php

function topnav_menu() { ?> <ul id="topnav">

<li><a href=“/wordpress">WordPress</a></li> <li><a href=“/wpmu">WPMU</a></li> <li><a href=“/buddypress”>BuddyPress</a></li> <li><a href=“/bbpress">bbPress</a></li>

</ul> <?php }

add_action('thesis_hook_before_header', 'topnav_menu'); ?>

Page 19: Advanced Thesis Techniques and Tricks

Example 4: Add A Secondary Menu

/* Top Nav bar */.custom ul#topnav {border-style: none;list-style-image: none;list-style-position: outside;list-style-type: none;background:#E4E4E4 none repeat scroll 0 0;width: 100%;float: left;}.custom ul#topnav li { float: left; padding: 3px 10px 3px 0px; }.custom ul#topnav li a { font-size: 1.1em; color: #000000; }.custom ul#topnav li a:hover { text-decoration: underline; }

Add a little styling in custom.css

Page 20: Advanced Thesis Techniques and Tricks

Example 4: Add A Secondary Menu

BAM! Another menu!

Ref: http://www.emptycabinmedia.com/thesis-theme-add-another-menu/

Page 21: Advanced Thesis Techniques and Tricks

Example 5: Widgetize your Multimedia Box

Page 22: Advanced Thesis Techniques and Tricks

Example 5: Widgetize your Multimedia Box

<?php

register_sidebar(array('name' => 'Multimedia Box', 'before_widget' => '<li class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3>', 'after_title' => '</h3>'));

function multimedia_box_widgets() { echo '<ul class="sidebar_list">'; dynamic_sidebar('Multimedia Box'); echo '</ul>';

}

add_action('thesis_hook_multimedia_box', 'multimedia_box_widgets');?>

Page 23: Advanced Thesis Techniques and Tricks

Example 5: Widgetize your Multimedia Box

Change the Multimedia Box settingto Custom code

Add any widgets you want to the Multimedia Box sidebar

Page 24: Advanced Thesis Techniques and Tricks

Example 5: Widgetize your Multimedia Box

Now we are widgetized!

Ref: http://rickbeckman.org/widgetizing-thesis-multimedia-box/

Page 25: Advanced Thesis Techniques and Tricks

And there is no more, I lied

In Summary, Thesis is a great theme for beginner and advanced users alike.

Page 26: Advanced Thesis Techniques and Tricks

Thesis Official Website – http://diythemes.com/thesis/ Thesis Theme User’s Guide

› http://diythemes.com/thesis/rtfm/

Thesis Hook References› http://diythemes.com/thesis/rtfm/hooks/› http://diythemes.com/thesis/rtfm/default-hook-usage/

Thesis Pro Users› Chris Pearson http://www.pearsonified.com/› Rick Beckman (KingdomGeek) http://rickbeckman.org/› Kristarella http://www.kristarella.com/

Thesis Resource Sites› http://thesisthemehq.com/› http://thesisgallery.com/

Thesis ResourcesThesis Resources

Page 27: Advanced Thesis Techniques and Tricks

Brad [email protected]

Blog: strangework.comtwitter.com/williamsbaIRC: WDS-Brad

Everywhere else: williamsba

ContactContact