Your SlideShare is downloading. ×
0
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Plugging into plugins
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Plugging into plugins

1,244

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,244
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Plugging into Plugins Josh Harrison @joshh
  • 2. About MeI work for 10up working on awesomeWordPress projectsI have a wife and 3 kids.I live in St. George UT.I just finished my backyard after working on itfor 4 months.
  • 3. WordPress Plugins What comes to mind?
  • 4. "Here is something I created. Maybesomebody else will find it useful."
  • 5. Plugins are FrameworksNot Blueprints
  • 6. It’s not about coreplugins, it’s aboutplugin developers making better plugins.
  • 7. Make your pluginsextensible and be nice to other developers
  • 8. Use the WordPress Core API.
  • 9. WordPress Core APIs● Database API● HTTP API● Shortcode API● Transients API● Shortcode APIAnd many more....
  • 10. Create your own actions and filters.
  • 11. do_actionif ( $valid_request ) { if ( $status == approve ) { // dev can remove or add to do_action( new_user_approve_approve_user ); } else if ( $status == deny ) { do_action( new_user_approve_deny_user ); }}
  • 12. apply_filters$welcome = sprintf( __( Welcome to %s. Thissite is accessible to approved users only.To be approved, you must first register.,new_user_approve ), get_option( blogname) );$welcome = apply_filters(new_user_approve_welcome_message, $welcome);
  • 13. Allow theme developers to override plugin templates.
  • 14. // Include template - can be overriden by a theme!$template_name = wp-core-contributions-widget-template.php;$path = locate_template( $template_name );if ( empty( $path ) ) { $path = WP_CORE_CONTRIBUTIONS_WIDGET_DIR . inc/ .$template_name;}
  • 15. Create template functions.
  • 16. /** * Display the permalink for the current post. * * @since 1.2.0 * @uses apply_filters() Calls the_permalink filter onthe permalink string. */function the_permalink() { echo apply_filters(the_permalink, get_permalink());}
  • 17. Create utility methods.
  • 18. /** * Creates a redirect post, this function will be usefulfor import/exports scripts * @param string $redirect_from * @param string $redirect_to * @param int $status_code * @since 1.3 * @uses wp_insert_post, update_post_meta * @return int */public function create_redirect( $redirect_from,$redirect_to, $status_code ) { ....}
  • 19. Decisions not options.Actions and filters are even better.
  • 20. /** If you hardcode a WP.com API key here, all key configscreens will be hidden */if ( defined(WPCOM_API_KEY) ) $wpcom_api_key = constant(WPCOM_API_KEY);else $wpcom_api_key = ;
  • 21. Anything else?
  • 22. Child PluginsPlugin Mashups
  • 23. CautionYoull have to keep you plugin up to date
  • 24. DisadvantagesThe wordpress.org repository does not supportplugin dependenciesWhat if a child plugin is installed, should theparent plugin be installed as well?
  • 25. What can I do now?● Update your plugins● Send an update to plugin authors● Fork it
  • 26. Resources● Pippin Williamson● Michael Fields● Brandon Dove - The Pluggable Plugin● WordPress Plugins as Frameworks

×