WordPress and PHP - It Takes One to Know One
-
Upload
lorelle-vanfossen -
Category
Education
-
view
17.917 -
download
1
Transcript of WordPress and PHP - It Takes One to Know One
![Page 1: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/1.jpg)
it takes one to know one
WordPress and PHPwith Lorelle VanFossen
![Page 2: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/2.jpg)
![Page 3: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/3.jpg)
WordPress Stats 25% of all sites on the web are published on WordPress
The latest version of WordPress has been downloaded almost 20 million times.
Median hourly wage of a WordPress project is $50.
Typical salary range for US web industry position with WordPress dev/design experience is $55-74K. Mobile experience, add $5-10K.
oDesk reports an average of 5,500 WordPress jobs posted a month.
WordPress runs The New York Times, Wall Street Journal sites, Ford, NY University Library, CNN, Harvard Law School, Ben & Jerry, People Magazine, NASA, Time Magazine, GE, MTV Newsroom, BBC Top Gear, National Geographic, TechCrunch, BoingBoing, AIGA Portland, The Economist, Comedy.com, Mozilla, Wired, Samsung, Le Monde Newspaper, Lexus, Nikon Pressroom, Official Star Wars Blog, Kobe Bryant, Carnival Cruise Line, Jay-Z…
![Page 4: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/4.jpg)
WordPress and PHP
• The core of WordPress is built on PHP• WordPress Themes:•WordPress Template Tags: Make WordPress go•WordPress Template Files: Make WordPress pretty•WordPress Functions.php file: Code in Design
• WordPress Plugins• Push the boundaries of WordPress• Separate code from design
![Page 5: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/5.jpg)
WordPress Site Recipe• Ingredients:• 6 cups HTML/XHTML/HTML5• 8 cups CSS/CSS3• 1/2 cup JavaScript• 12 cups PHP• 7 cups WordPress Template Tags• 1 tablespoon common sense
Mix all ingredients into WordPress Template Files. Add MySQL data and process through the WordPress Loop. Add code from the functions.php file. Mix well. Season with WordPress Plugins and GPL.
![Page 6: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/6.jpg)
PHP
Template Tags
WordPress Theme = Template Files
+ functions.php
WordPress Plugins
Generated Pageview
![Page 7: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/7.jpg)
Anatomy of a Template Tag
<?php bloginfo('name'); ?><?php bloginfo('description'); ?>
<?php bloginfo('url'); ?>
<p>Powered by WordPress version <?php bloginfo('version'); ?></p>
Powered by WordPress version 3.4
![Page 8: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/8.jpg)
Anatomy of a Template TagClickable header
<div id="header"><a href="<?php bloginfo('url'); ?>"
title="<?php bloginfo('name'); ?> - <?php bloginfo('description'); ?>">
<?php bloginfo('name'); ?></a>
</div>
<a href="http://lorelle.wordpress.com/" title="Lorelle on WordPress – WordPress
Tips">Lorelle on WordPress</a>
![Page 9: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/9.jpg)
Anatomy of a Template Tag
<?php the_title(); ?>
Parameters: <?php the_title('before', 'after', display); ?>
<h2><?php the_title('Post Title: ', ' »'); ?></h2>
Post Title: Anatomy of a Template Tag »
![Page 10: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/10.jpg)
Anatomy of a Template Tag
Boolean Template Tags connect multiple paramters together
<?php wp_list_categories( $args ); ?>
<ul><?php wp_list_categories('orderby=name&include=3,5,16'); ?></ul>
![Page 11: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/11.jpg)
The WordPress Loop<?php get_header(); if (have_posts()) :
while (have_posts()) : the_post(); the_content();
endwhile; endif; get_sidebar(); get_footer(); ?>
![Page 12: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/12.jpg)
The WordPress Loop<?php get_header(); if (have_posts()) :
while (have_posts()) : the_post(); the_content();
endwhile; endif; get_sidebar(); get_footer(); ?>
![Page 13: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/13.jpg)
<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- The following tests if the current post is in category 3. If it is, the div box is given the CSS class "post-cat-three". Otherwise, the div box will be given the CSS class "post". --> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div>
<!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?></p> </div> <!-- closes the first div box -->
<!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?>
<!-- The very first "if" tested to see if there were any Posts to display --> <p>Sorry, no posts matched your criteria.</p>
<!-- REALLY stop The Loop. --> <?php endif; ?>
![Page 14: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/14.jpg)
<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- The following tests if the current post is in category 3. If it is, the div box is given the CSS class "post-cat-three". Otherwise, the div box will be given the CSS class "post". --> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div>
<!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?></p> </div> <!-- closes the first div box -->
<!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?>
<!-- The very first "if" tested to see if there were any Posts to display --> <p>Sorry, no posts matched your criteria.</p>
<!-- REALLY stop The Loop. --> <?php endif; ?>
WordPress Function Tags
![Page 15: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/15.jpg)
<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- The following tests if the current post is in category 3. If it is, the div box is given the CSS class "post-cat-three". Otherwise, the div box will be given the CSS class "post". --> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div>
<!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?></p> </div> <!-- closes the first div box -->
<!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?>
<!-- The very first "if" tested to see if there were any Posts to display --> <p>Sorry, no posts matched your criteria.</p>
<!-- REALLY stop The Loop. --> <?php endif; ?>
![Page 16: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/16.jpg)
<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- The following tests if the current post is in category 3. If it is, the div box is given the CSS class "post-cat-three". Otherwise, the div box will be given the CSS class "post". --> <?php if ( in_category('3') ) { ?> <div class="post-cat-three"> <?php } else { ?> <div class="post"> <?php } ?> <!-- Display the Title as a link to the Post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. --> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<!-- Display the Post's Content in a div box. --> <div class="entry"> <?php the_content(); ?> </div>
<!-- Display a comma separated list of the Post's Categories. --> <p class="postmetadata">Posted in <?php the_category(', '); ?></p> </div> <!-- closes the first div box -->
<!-- Stop The Loop (but note the "else:" - see next line). --> <?php endwhile; else: ?>
<!-- The very first "if" tested to see if there were any Posts to display --> <p>Sorry, no posts matched your criteria.</p>
<!-- REALLY stop The Loop. --> <?php endif; ?>
![Page 17: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/17.jpg)
WordPress Template Files• Modular elements create a WordPress Theme• Code and data called with template tags,
functions, conditional tags, and post queries• Automatic and customizable hierarchy
header.php
index.phpsingle.phppage.php
category.php
archive.php
sidebar.php
footer.php
If pageview is single and in category 3, show sidebar 2.
If pageview is category, show sidebar 3
If pageview is front, show sidebar on left.
If category view requested, automatically switch to category template file.
![Page 18: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/18.jpg)
Extend WordPress Themes
Child Themesfunctions.php template fileWordPress Plugins
![Page 19: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/19.jpg)
WordPress Child Themes
• Protect original files• Allow protected customization• Use CSS !important
inheritance. • Child Theme code overrides Parent Theme code.
• Child Theme customization lost with Theme change.
![Page 20: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/20.jpg)
WordPress Theme functions.php file
• Template file strictly for adding code customization.• Uses WordPress Hooks to extend:• Parent Theme elements• WordPress Administration Screens
• Attaches to specific Theme, not all Themes.• Theme functions.php lost when changing Themes.
<!– - Set excerpt length from default to 200 words - - > function custom_excerpt_length( $length ) {
return 200; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
![Page 21: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/21.jpg)
WordPress Theme functions.php file
• Add options to Administration Panels (backend)• Theme options• Change user interface• Add functionality
![Page 22: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/22.jpg)
Power of WordPress ThemesTwenty-Eleven WordPress ThemeBuilt-in Customizations
![Page 23: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/23.jpg)
WordPress Plugins• Extend WordPress Theme design and functionality• Preserve function with Theme switches• Extend WordPress Administration Screens
![Page 24: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/24.jpg)
WordPress.com Stats
BuddyPress
XML Sitemap Generator
NextGEN Gallery
My Blog’s Building Blocks
@lorelleonwp
![Page 25: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/25.jpg)
US Department of Homeland Insecurity
Idiocy Level for WordPress
Talk Like a Pirate DaySeptember 19, 2012Text Filter Suite WordPress Plugin
CSS Naked DayWordPress PluginAnnually in April
Suicide Squirrel Threat Advisory System
Related Ways to Take Action
WRP-CardsWordPress Plugin
![Page 26: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/26.jpg)
Next of Kin WordPress PluginThis Plugin is useful for those that want their blog to out-live them, and serve as an online memorial. Even without use of this Plugin, all are recommended to make sure someone can handle their website in case of emergency.
Tags: afterlife, death, will
![Page 27: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/27.jpg)
The Events Calendar WordPress Plugin
![Page 28: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/28.jpg)
Edit Flow WordPress Plugin
• Designed for newsroom editorial workflow.• Tracks content to visualize content and priorities.
![Page 29: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/29.jpg)
Edit Flow WordPress Plugin
![Page 30: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/30.jpg)
WP Invoice WordPress Plugin
![Page 31: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/31.jpg)
Feed Pauser WordPress Plugin
![Page 32: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/32.jpg)
WP Content Filter
sh*t
F**k P***G*D
D****T
Ba***rd
A*****e
F****ER
Je**sSon of a b****h
D**n
![Page 33: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/33.jpg)
Customizable Post ListingsCustomizable Comment
Listings
![Page 34: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/34.jpg)
Customizable Post Listings
![Page 35: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/35.jpg)
phpMyAdmin WordPress Plugin
![Page 36: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/36.jpg)
MyFTP WordPress Plugin
![Page 37: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/37.jpg)
http://lorelle.wordpress.com/2007/02/06/a-love-letter-to-wordpress-plugin-authors/
![Page 38: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/38.jpg)
How NOT to Describe a WordPress Plugin
A New Plugin For Your New WordPress Version
The latest WordPress version was launched. Yes, WordPress 3.0 was already available and ready to optimize for our blog. Indeed, WordPress is always the best blogging platform for me and I believe for many other blogger. However, as in title, I will introduce you with a great WordPress Plugin which I believe perfectly match with WordPress 3.0. It can be said as a new plugin for a new WordPress blog.
![Page 39: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/39.jpg)
How to Describe a WordPress Plugin
Best Blogroll WordPress Plugin
Allows customization of the blogroll or sidebar links.
![Page 40: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/40.jpg)
Embrace Code Standards
![Page 41: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/41.jpg)
Releasing WordPress Plugins Into the Wild• Test in variety of environments and start early. • TEST TEST TEST TEST TEST.• Know your licenses (understand GPL thoroughly)• Be ready to update fixes immediately.• Make it brain-dead stupid to use.• Add version numbers EVERYWHERE including
database option arrays.• Ask users the version number.• URL Bugs: Embrace https, subdomains,
subwebs.
![Page 42: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/42.jpg)
Plugins in the Wild• Prepare for feedback
• Your site clearly shows links to Plugins and expertise• WordPress Plugin Directory• WordPress Support Forums
• Promote and Monitor• WordPress Support Forums• Google Search• Twitter• Facebook• Stackoverflow• oDesk
• Never assume.• Listen, Listen, Listen, LISTEN DAMN IT!
![Page 43: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/43.jpg)
The WordPress Codex is your friendhttp://codex.wordpress.org/
![Page 44: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/44.jpg)
Nine APIs in WordPress
![Page 45: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/45.jpg)
Things you need to know to code WP• Code, Web, and Accessibility Standards • PHP 5+• JavaScript, AJAX, jQuery• Apache/Unix basics• HTML/CSS• XML• API• Trac/Subversion• Mobile
![Page 46: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/46.jpg)
WordPressers justwanna havefun!
![Page 47: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/47.jpg)
CTEC 280 Introduction to WordPress
• Only full college credit WordPress course in the world.
• Overview of WordPress publishing and content management platform• Content development• Layout and design• WordPress Themes• WordPress Plugins• Underlying technologies• Interactivity• Social web integration
Tues & Thurs6-8:30 PM
July 3 – August 23ITEM # 1867
![Page 48: WordPress and PHP - It Takes One to Know One](https://reader030.fdocuments.in/reader030/viewer/2022032514/55d4baafbb61eb686c8b45a2/html5/thumbnails/48.jpg)