wordpress theme hacks nearly anyone can do afraid you might "break something" by mucking...
TRANSCRIPT
![Page 1: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/1.jpg)
Wordpress Theme Hacks Nearly Anyone Can Do
Afraid you might "break something" by mucking around in your theme? With a little determination, and just a few keystrokes - you'd be surprised how many things you can change on your own.
![Page 2: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/2.jpg)
How I Met Wordpress
THIS WAS MEFor
10 LONG YEARS
![Page 3: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/3.jpg)
In 1999 I was hired as a webmaster
I was VERY loyal
![Page 4: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/4.jpg)
Webmasters Did Everything
• HTML
• Javascript
• Graphics
• Technical Writing
• CGI/Perl Coding
• UNIX Shell Coding
• Create Online Tools
• Training
![Page 5: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/5.jpg)
Open Source CMS
I tried to introduce multiple Open Source CMSSystems to Automate my Job
![Page 6: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/6.jpg)
Big Money Always Won
![Page 7: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/7.jpg)
I Met Wordpress in 2004
![Page 8: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/8.jpg)
I Thought They Were Wrong...
So I kept using Wordpress on My Own...
Sometimes instead of doing my real work.
![Page 9: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/9.jpg)
Little Did I Know...
In 2009 they outsourced the last of us...the last of the “webmasters” that is.
![Page 10: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/10.jpg)
I Was Out of Work
No Jobs. Unemployment.Couldn't Move.
What Now?
![Page 11: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/11.jpg)
Reinvention
![Page 12: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/12.jpg)
Wordpress Theme Hacks Nearly Anyone Can Do
You Will Need to: Use the Wordpress
dashboard editor Know basic HTML Be able to Edit, Copy
and Paste small amounts of PHP Code
![Page 13: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/13.jpg)
Why Hack a Wordpress Theme?To stand out or look different
create a look nobody else hasTo add functionality for the end user
“like”, “tweet”, disqusTo enhance the way content is displayed
post meta, text, images, “the_loop”, navigationTo customize specific pages
search results, 404 Pages, archives, category & tags pagesTo show content only when conditions are met
only on the home page, just singles posts, only tag pages, etc.
![Page 14: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/14.jpg)
How Do I Edit My WP Theme?
In WP dashboard: Appearance → EditorClick on the page you want to edit:
![Page 15: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/15.jpg)
What Are All Those Theme Pages?
At Bare Minimum, Most WP Themes Have:index.php (home page + a whole lot more)single.php (single posts)page.php (paged pages – like your “about” page)comments.php (the comments block after content)header.php (before the content on EVERY page)footer.php (after the content on EVERY page)sidebar.php (what's in the sidebar)functions.php (special theme specific PHP code)style.css (text formatting and layout rules)
Reference: http://codex.wordpress.org/Template_Hierarchy
![Page 16: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/16.jpg)
Which file does what?
A page file (index, single, page) calls and loads other files for specific page content areas:
![Page 17: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/17.jpg)
How Many Pages Could MyWP Theme Have?
The Bare Minimum index.php
single.php
page.php
comments.php
header.php
footer.php
functions.php
sidebar.php
style.css
Optional Theme Pages archive.php (date based archives)
search.php (search results)
category.php (category pages)
tag.php (tag pages)
404.php (not found errors)
attachment.php (attachments)
author.php (author page)
loop.php (Wordpress 3.0+)
Countless custom template files
![Page 18: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/18.jpg)
Why Use Conditional Tags
To do something only whencertain conditions are met
Examples: Show specific text or images Create custom adverts for specific uses Designate alternate layouts for certain pages Using plugins to do this slows down your site
![Page 19: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/19.jpg)
Where can I use Conditional Tags?
Conditions such as “is_home” with “is_front_page”, “is_single”, “is_sticky”, “is_page”, “is_page_template”, “is_category”, “is_tag”, “is_author”, work great in sections such as:
index.php Header or Footer Sidebars the_loop Comments block
![Page 20: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/20.jpg)
Very Specific Conditions
Specify individual pages like is_single('hello') or in_category('5'), is_page_template('contact.php'), is_tag('ipod') or has_tag('ipod'), is_author('john-pratt'), is_date(), is_single(array('my-best-post', 'my-worst-post'))
Specific category and tag pages Specific template pages Specific archive pages Specific post ID'sReference the Codex:
http://codex.wordpress.org/Conditional_Tags
![Page 21: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/21.jpg)
Hacking with Conditional Tags
Do “ABC” when “XYZ” Condition is met:
<?php if (is_home()) { ?>Show my big block of SEO keyword-laden text
<? } ?>
By replacing “is_home” with “is_front_page”, “is_single”, “is_sticky”, “is_page”, “is_page_template”, “is_category”, “is_tag”, “is_author”, “is_date”, “is_archive”, or “is_attachment” to make your message show up on nearly any WordPress page.
![Page 22: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/22.jpg)
Having Multiple Conditions
Do “ABC” when “XYZ” Condition is met, elseif single post page do “DEF”
<?php if (is_home()) { ?>Show my home page text block
<?php } elseif (is_single()) { ?>Show my single post text block instead
<? } ?>
In this example we show custom text for the home page, or on single pages. If neither condition is met – we don't show any custom text.
![Page 23: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/23.jpg)
Multiple Conditions Else Default
Do “ABC” when “XYZ” Condition is met, elseif single post page do “DEF”, else show do default
for all other instances
<?php if (is_home()) { ?>Show my home page text block
<?php } elseif (is_single()) { ?>Show my single post text block instead
<?php else { ?>Show my default text for all other conditions
<? } ?>
![Page 24: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/24.jpg)
Using Multiple Conditions
Combine conditions on one statement to show the same thing in multiple places.
<?php if (is home() || is_single() || is_category() || is_page() || is_archive() { ?>
Show this text for all those conditions
<?php } ?>
The double-pipe or || in the code signifies “OR”, so WordPress knows, if this is home, or a single page, or a category page, or a “page” page, or an archive page – show the same thing for all.
![Page 25: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/25.jpg)
Show Everywhere, Except...
Use the concept in reverse to show everywhereexcept where you don't want it...
<?php if (is_home()) {}Else { ?>
<p>Show this everywhere!</p>
<?php } ?>
In this example we show nothing when the home page is shown,“else” show it every other time.
![Page 26: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/26.jpg)
Conditionally Use WP Functions
Use a Conditional tag to force a WP Function
<? php if (is_home()) {wp_list_bookmarks();}?>
Use conditional statements to do things like get_tags, get_category_parents, get_page_children, get_user_meta, and many more...
Reference: http://codex.wordpress.org/Function_Reference
![Page 27: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/27.jpg)
Hacking Your Comments
Plugins like “subscribe to comments” or “CommentLuv” are great enhancements
By modifying the text in comments.php, you can customize what your comments block says (or how it looks)
By modifying some of the code, you can add (or remove functionality)
Get rid of comment spam at the source
![Page 28: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/28.jpg)
Add Delete and Spam Linksto Your Comment Sections
Add this code to your theme's functions.php file:
function delete_comment_link($id) { if (current_user_can('edit_post')) { echo '| <a href="'.admin_url("comment.php?action=cdc&c=$id").'">del</a> '; echo '| <a href="'.admin_url("comment.php?action=cdc&dt=spam&c=$id").'">spam</a>'; }}
Add this code to your comments.php where you want the links (usually add it in where you find edit_comment_link()):
delete_comment_link(get_comment_ID());
Source: http://www.wprecipes.com/how-to-add-del-and-spam-buttons-to-your-comments
![Page 29: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/29.jpg)
Stop HTML Links in Comments
Add this to your functions.php file, all links will be stripped:
function plc_comment_post( $incoming_comment ) {$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);$incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );return( $incoming_comment );}
function plc_comment_display( $comment_to_display ) {$comment_to_display = str_replace( ''', "'", $comment_to_display );return $comment_to_display;}
add_filter('preprocess_comment', 'plc_comment_post', '', 1);add_filter('comment_text', 'plc_comment_display', '', 1);add_filter('comment_text_rss', 'plc_comment_display', '', 1);add_filter('comment_excerpt', 'plc_comment_display', '', 1);
Reference: http://www.wprecipes.com/how-to-get-rid-of-links-in-your-comments
![Page 30: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/30.jpg)
Prevent Most Comment Spam
Most Spammers use software or scripts that have no referrer. Require all comments come from a web browser to stop the spammers dead!
Add this to your functions.php file:
function check_referrer() { if (!isset($_SERVER['HTTP_REFERER']) ||$_SERVER['HTTP_REFERER'] == “”) { wp_die( __('enable referrers or go away') ); }}add_action('check_comment_flood','check_referrer');
Source: http://www.smashingmagazine.com/2009/07/23/10-wordpress-comments-hacks/
![Page 31: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/31.jpg)
Hacking Navigation
Add things to your blog that will make it more usable and help readers find what they need
Breadcrumb Plugins Related Posts Plugins Most Viewed / Popular Post Plugins Category Icons Plugins
![Page 32: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/32.jpg)
Remove Next / Previous Links
Replace with more common “pagination” links
WP-Page Numbers Plugin WP-PageNavi Plugin
![Page 33: Wordpress Theme Hacks Nearly Anyone Can Do Afraid you might "break something" by mucking around in your theme? With a little determination, and just a](https://reader036.vdocuments.net/reader036/viewer/2022081414/5513ccf25503463a298b4f47/html5/thumbnails/33.jpg)
Q&A
Find me:
facebook.com/jtprattmedia
www.jtprattmedia.com
www.jtpratt.com/blog
twitter.com/jtpratt
wp-dir.com