WordPress Plugins
-
Upload
randyhoyt -
Category
Technology
-
view
2.718 -
download
1
Transcript of WordPress Plugins
About Me• Web Developer – imaginuity.com
Links
Personal Contact –
Presentation –
http://randyhoyt.com@randyhoyt
http://r2h.me/plugins
WordPress 1.2http://wordpress.org/news/2004/05/heres-the-beef/
WordPress 1.2 – New Plugin Architecturehttp://wordpress.org/news/2004/05/heres-the-beef/
About Me• Web Developer – imaginuity.com
Plugin Architecture
Hooks: - Pre-defined places in WordPress where plugins and
themes can inject their own code
Two Types of Hooks:- Filters – For modifying various pieces of text- Actions – For executing code triggered by an event
About Me• Web Developer – imaginuity.com
Filters
• Modify pieces of text that WordPress generates
• Functions:
- add_filter( $tag, $new_function, $priority, $accepted_args );- Applies a function to a filter hook- http://codex.wordpress.org/Function_Reference/add_filter
- remove_filter( $tag, $new_function, $priority, $accepted_args );- Removes a function from a filter hook to which it has been added- http://codex.wordpress.org/Function_Reference/remove_filter
About Me• Web Developer – imaginuity.com
Filters: Examples
the_content - applied to the post content retrieved from the database, prior to printing
on the screen
wp_list_pages- applied to the HTML list generated by the wp_list_pages function
single_template, archive_template, etc.- plugins can modify the template files to be used with a filter returning the
path to a new template file
• Screenshot TwentyTen
WP Tweet Buttonhttp://wordpress.org/extend/plugins/wp-tweet-button/
• Screenshot TwentyTen
198 add_filter('the_content', array(&$this, 'tw_update'));
578 function tw_update($content) {612 $button = $this->tw_generate_button();621 return $button . $content;634 }
Hoyt FamilyPassword-Protected Blog
Hoyt Family
function RRH_rss_remove_excerpt( $output ) { return "Please log in to our family web site to view this update."; } add_filter('the_excerpt_rss', 'RRH_rss_remove_excerpt');
Remove Wordpress to WordPress filterhttp://wordpress.org/extend/plugins/remove-wordpress-to-wordpress-filter/
remove_filter('the_content','capital_P_dangit',11);remove_filter('the_title','capital_P_dangit',11);remove_filter('comment_text','capital_P_dangit',11);
Remove Wordpress to WordPress filterhttp://wordpress.org/extend/plugins/remove-wordpress-to-wordpress-filter/
About Me• Web Developer – imaginuity.com
Actions
• Execute code when an event in WordPress occurs
• Functions:
- add_action( $tag, $new_function, $priority, $accepted_args );- Applies a function to a filter hook- http://codex.wordpress.org/Function_Reference/add_action
- remove_action( $tag, $new_function, $priority, $accepted_args );- Removes a function from a filter hook to which it has been added- http://codex.wordpress.org/Function_Reference/remove_action
About Me• Web Developer – imaginuity.com
Actions: Examples
the_content - applied to the post content retrieved from the database, prior to printing
on the screen
wp_list_pages- applied to the HTML list generated by the wp_list_pages function
single_template, archive_template, etc.- plugins can modify the template files to be used with a filter returning the
path to a new template file
• Admin Favicon
Admin Faviconhttp://wordpress.org/extend/plugins/admin-favicon/
function Adminfavicon() { $options = get_option('favi_insert_url'); echo '<link rel="shortcut icon" href="' . $options[favi_url] . '" />';}add_action('admin_head', 'Adminfavicon');
Admin Faviconhttp://wordpress.org/extend/plugins/admin-favicon/
• Redirector
Redirectorhttp://wordpress.org/extend/plugins/redirector/
• Redirector
Redirectorhttp://wordpress.org/extend/plugins/redirector/
function re_adminhead(){
add_meta_box('redirect', __('Redirect','redirector'), 're_metabox', 'page');}add_action('admin_head', 're_adminhead');
add_action('save_post', 're_meta_save');function re_meta_save(){ $redirect_to = $_POST['redirector']; if ($redirect_to)
update_post_meta($_POST['ID'], 'redirector', $redirect_to); else
delete_post_meta($_POST['ID'], 'redirector');}
Redirectorhttp://wordpress.org/extend/plugins/redirector/
WP Tutorial: Your First WP Pluginhttp://markjaquith.wordpress.com/2006/03/04/wp-tutorial-your-first-wp-plugin/
About Me• Web Developer – imaginuity.comPlugins
vs.
functions.php
WP-PageNavihttp://wordpress.org/extend/plugins/wp-pagenavi/
Maintenance Modehttp://wordpress.org/extend/plugins/maintenance-mode/
Theme My Login & Theme My Profilehttp://profiles.wordpress.org/users/jfarthing84/
KB Advanced RSS Widgethttp://wordpress.org/extend/plugins/kb-advanced-rss-widget/
KB Advanced RSS Widgethttp://wordpress.org/extend/plugins/kb-advanced-rss-widget/
Analytics360°http://wordpress.org/extend/plugins/analytics360/
Query Postshttp://wordpress.org/extend/plugins/query-posts/
Query Postshttp://wordpress.org/extend/plugins/query-posts/
TweetOnPosthttp://wordpress.org/extend/plugins/tweetonpost/
Wordbookerhttp://wordpress.org/extend/plugins/wordbooker/
• WordBooker• Twitter on Post• Contact Form 7 / Gravity Forms
Gravity Formshttp://www.gravityforms.com/