Introduction To Simple WordPress Plugin Development

Slides:



Advertisements
Similar presentations
Installing Instant WordPress 1)Download Instant WordPress from the following location:- 2) Double Click on the downloaded.
Advertisements

This presentation can be downloaded at Presented by the Office of Public Affairs Using the Cal State L.A. Web.
Seattle Drupal Clinic Introduction to Drupal and Web Content Management.
Easy Website Creation Using WordPress Welcome and Thank You to our Sponsors.
Drupal Online Tutorial A Product of an ENGL 421 class at Purdue University Page 1.
Νοέμβριος 2007 ΝΙΚΟΛΑΟΣ ΚΑΝΤΖΕΛΗΣ Use Worpress to create your own blog WORDPRESS 2.0.
Create Your Own Webpage. Today’s Agenda Group activity Wordpress –Photos –Widgets –Header –Theme Prepare to share sites w/small group Wednesday.
Creating Wordpress Plugins. Who is Here? PHP GTA Meetup Wordpress Toronto Meetup East Toronto Web Design Meetup.
INSTALLATION OF WORDPRESS. WORDPRESS WordPress is an open source CMS, often used as a blog publishing application powered by PHP and MySQL. It has many.
Content Management, Working with WordPress Svetlin Nakov Telerik Corporation
Getting an account with WordPress.com Open your web browser ( mozilla firefox, internet explorer, opera, etc.,)
About the CMS WordPress A brief overview of both Wordpress.org & WordPress.com WordPress is one of the most popular content management and blog publishing.
The easy way to a nice looking website design By a total non-designer (Me!)
Jiří Balej, Martin Podborský, Petra Čačková.  Tools, which enables to produce content without source code knowledge  Text document ◦ MS Word/OO Writer.
What is Wordpress?  WordPress has a web template processor. Users can re-arrange widgets without editing PHP of HTML code; they can also install and.
Create Your Own Webpage. Today’s Agenda Cut & paste code Notepad++ or Notepad at home FTP Web Hosting Wordpress.
Blogging. What is Blogging? "Blog" is an abbreviated version of "web-log,” A blog is a frequently updatable, personal website featuring diary-type commentary.
Wordpress Tutorial 22 – 24 April Table of Contents Introduction Designing blog Writing and Publishing blog Pages Posts Categories Tags Links Comments.
Sahil Narang What is CMS? A content management system (CMS) is a computer application that allows publishing, editing and modifying content,
Drupal Workshop Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology, Drupal technology, directories.
Basics of Administration & Theming - Smarajit Dasgupta.
Launch Your WordPress site in One Hour By Bret Phillips For slides, codes, and notes: Web Devils WordPress.
WordPress Web. WordPress Blogging system with full content management Personal publishing system Built on PHP scripting language and MySQL relational.
Website Confidence By Andrea Bailey and Nedra Rezinas.
What is Drupal? Open Source software written in php. A CMS or content-management system. A sophisticated web application building tool.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Exploring Microsoft Office Word 2007 Chapter 8 Word and the Internet Robert Grauer, Keith.
INTRODUCTION TO WORDPRESS. About WordPress The free service that we will use from WordPress is often used as blogging software – very little knowledge.
WordPress Plugin Development A Starter Guide For Beginners.
WordPress Architecture ► Core files – PHP ► MySQL database  Configured by the installation script ► wp-content directory  themes subdirectory: layout.
Seattle Drupal Clinic Introduction to Drupal Part 1: Web Content Management, Advantages/Disadvantages of Drupal, Drupal terminology.
USING WORDPRESS TO CREATE A WEBSITE (RATHER THAN A BLOG) STEP-BY-STEP INSTRUCTIONS.
Web Analytics See what’s working… and what’s not.
My Workspace ELearning in Sakai Randy Graff, PhD HSC Training.
Setting Up your Hosting Account and Installing WordPress and Omeka CCC America Advanced Omeka Training.
USING WORDPRESS TO CREATE A WEBSITE (RATHER THAN A BLOG) STEP-BY-STEP INSTRUCTIONS.
Getting Started. Package Overview (GradeQuick)‏ Web-based grade book –Access Anywhere –Always Current Paper grade book “look and feel” Flexible grading.
HINDU STYLE PORTFOLIO TEMPLATE
+ Publishing Your First Post USING WORDPRESS. + A CMS (content management system) is an application that allows you to publish, edit, modify, organize,
PHP Form Processing * referenced from
Intro to APACHE, MySQL, and PHP & freely available (hackable) Packages Aonghus Sugrue 04 Oct 2012.
…for beginners Class #2. Reminders Tues 7/21, 7/28, 8/4: 7-9:30pm at CMU 243 (UW) WiFi (UW) user: event0960, pass: aEBk_uYXf_uUMm class website (new slides!):
Here are some things you can do while you wait 1.Open your omeka.net site in your browser (e.g. 2.Open.
Weebly is Your Friend. * To Enhance And Promote Your Curriculum * To Provide A Student Resource * Add Efficiency to Your Planning * Informational * Promote.
How to use Drupal Awdhesh Kumar (Team Leader) Presentation Topic.
Learn What’s New in WordPress4.0 Presented by: SunTecOSS.
The main menu options and their usage are: Dashboard This will display your main Dashboard ‘homepage’. In the top left of your Dashboard you’ll see some.
Getting an account with WordPress.com
Intro to WordPress (Using XAMPP)
WordPress Introduction
Using Blogs in Your Classroom: Stimulating Students to
Developing WordPress Plugins
WWW – Why Work with Widgets
How to use.
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
Wordpress Tiger Tech 2017.
What is a Blog? short for Weblog journal on a website
Ultimate Guide to WordPress Plugin Development
PHP Training at GoLogica in Bangalore
WordPress Development
WordPress Plugins.
Easy Website Creation Using WordPress
© 2016 Blackboard Inc. All rights reserved..
Samer Koda IEEE-SEM – Section Student Representative IEEE-SEM-SA – Webmaster 12/7/2018.
So you were told to make a website
WordPress Development
How to Maintain Your ARS Websites
Wordpress test.cs.edinboro.edu.
Rev Up Your Design Cycle With DesktopServer
Business Prototype Look and Feel
WordPress Development
Presentation transcript:

Introduction To Simple WordPress Plugin Development Develop the skills of planning and developing your plugins with emphasis on hooks, callback functions and more!

About Bruce Chamoff CEO of Hot Web Ideas, Inc, hotwebideas.net, a New York based web development firm of over 20 years with a portfolio of over 1,000 websites including Korg, JP Morgan Chase, Whirlpool, UBS A WordPress theme and plugin developer of 9 years Instructor on 5 Udemy.com WordPress Development Courses A contributor to the WordPress.org development forums Speaker at WordCamps. Dad with one daughter.

What Exactly Is a Plugin? It is a PHP script that extends WordPress to perform new functions out of the box. Allows developers to change the WordPress core without modifying any of its code. Contains a combination of PHP, HTML, CSS, and Javascript. The PHP code of any plugin consists of a combination of one or more WordPress hooks and one or more callback functions. Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Why Do We Need Plugins?* DON’T HACK THE CORE! To prevent hacking the WordPress core To protect our code from WordPress updates To extend the basic WordPress installation and allow it to perform new functionality DON’T HACK THE CORE! Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

What Is The WordPress Core? All folders and files outside of the wp-content directory including: Root WP-includes WP-admin We CAN edit anything under the WP-Content directory Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Where is the Code for Plugins Stored? Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

How To Name a Plugin Since plugins are PHP files, they can have any file name with a .PHP extension, but for best practices, identical to its folder name. They can be stored in a folder or directly in the wp-content /plugins directory. Examples of plugin folders and names include: wp-content /plugins/folder-name/my-plugin.php wp-content /plugins/my-plugin.php Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Simple Plugin Plan Planning your plugin involves 5 simple questions: Who will use your plugin? When will your plugin run? Where will your plugin run? What will execute? How will it execute? Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Plugin Architecture & Coding Structure 1. File Header 2. Hook add_filter(‘HOOK NAME’,’CALLBACK FUNCTION REFERENCE’); or add_action These 2 must match. 3. Callback Function function CALLBACK FUNCTION () { All PHP content which can include WordPress API code, wp_content, get_posts. return data, PHP variable, object, array, string literal, etc; }

More About Hooks There are two types of hooks: action and filter hooks. Action hooks tell WordPress to perform an action. Filter hooks tell WordPress to change some part of the content. Hooks are a necessary part of any plugin as they instruct WordPress to act on a certain feature or piece of content. They tell WordPress when, where, and for whom to run the code inside the plugin. Themes can also include hooks in their functions.php file. Interesting Fact: Drupal also uses hooks in its modules. There are hundreds of hooks listed at: https://codex.wordpress.org/Plugin_API/Filter_Reference https://codex.wordpress.org/Plugin_API/Action_Reference Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

My Most Frequently Used Hooks Action Hooks: admin_menu rest_api_init init admin_init admin_notices wp_dashboard_setup admin_bar_menu wp_enqueue_scripts show_user_profile edit_user_profile personal_options_update edit_user_profile_update login_form_login widgets_init customize_register after_setup_theme Filter Hooks: the_content admin_footer_text body_class login_headertitle wp_footer the_modified_time Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Hook Example: Announce New FB Page Where: At the end of every blog post. When: N/A Who: Any public user (non-admin role) Use: the_content Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Hook Example: Greet an Admin Where: In the WordPress back end When: When an admin entered the back end Who: Someone with the administrator or editor user role Use: admin_notices Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Hook Example: Greet an Admin Where: In the WordPress user editing screen When: Any user clicks the Edit Profile link Who: Any user with rights to edit his/her profile. Use: edit_user_profile Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Hook Example: Run Javascript Files Where: Anywhere Javascript is needed When: Our plugin executes Who: N/A Use: wp_enqueue_scripts Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

More About The Callback Function It is a regular PHP function. Besides PHP code, it can contain WordPress API code. See Next Slide The function name must match the callback function’s reference in the referring hook. The code for callback functions can also be written as object-oriented code as well. Depending on the hook calling the function, it can accept any number of parameters or none. Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

My Most Frequently Used WordPress APIs in Plugin Callback Functions Options API Transients API Metadata API Theme Customization API (also used in themes known as the customizer) Shortcode API Widgets API Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Review: Steps For Developing Our Plugin Open our text editor (Notepad++, Edit Plus, BBEdit, Notepad, etc.) Add the PHP directives. Write our plugin header. Write our hook. Write our callback function. Add supporting files (images, HTML, CSS, Javascript) Save our plugin as a PHP script under wp-content/plugins/folder-name/plugin-name.php Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

A Simple Plugin: Add Your URL To All Posts and Pages <?php /* Plugin Name: Add My URL Description: Add any URL to the end of all WordPress posts and pages Version 1.0 Author: Bruce Chamoff Author URL: http://www.hotwebideas.net */ add_filter(‘the_content’, ’add_my_website’); function add_my_website($content) { $new_content = $content . ‘<p><a href=“http://www.hotwebideas.net”>Visit My Website</a></p>’; return $new_content; } ?> Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff

How To Customize This Plugin Look at the slide titled All the code you need or click this link. Open your favorite text editor and copy the PHP code to a new file. Save the file as specialid_add_to_the_end.php where specialid can be any ID you want such as hwi_add_to_the_end.php

How To Customize This Plugin (continued) Customize the header: /* header Plugin Name: Add My URL Description: Add any URL to the end of all WordPress posts and pages Version 1.0 Author: Bruce Chamoff replace with your name Author URL: http://www.hotwebideas.net replace with your URL */ Change the author name to YOUR name. 2. Change the URL to YOUR URL or social media page.

How To Customize This Plugin (continued) Customize the callback function: //callback function function add_my_website($content) { $new_content = $content . ‘<p><a href=“http://www.hotwebideas.net”>Visit My Website</a></p>’; return $new_content; } 1. Change the URL to your new site or social media page. 2. Change the call to action to any thing you want.

Installing Your New Plugin Now, you can upload it to your WordPress site. Follow these steps: Save your plugin as a zip file. Log into your WordPress admin. Click on PluginsAdd New. Continued on next page.

Installing Your New Plugin (Continued) Click Upload Plugin.

Installing Your New Plugin (Continued) Click Choose File.

Installing Your New Plugin (Continued) Navigate to your zip file and double-click it.

Installing Your New Plugin (Continued) Click Install Now.

Activating Your New Plugin (Continued) Click Activate Plugin.

Activating Your New Plugin (Continued) Congratulations! Your new plugin is activated and should now display your new URL at the end of every blog post!

Contact & Q&A Contact Me For Plugin Help I will answer any question… Twitter @BruceChamoff WebDesignerMall.com Udemy.com http://udemy.com/user/brucechamoff Get 50% Off My WordPress Development courses with coupon code WORDCAMP I will answer any question… Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoff I teach WordPress Development Courses at http://udemy.com/user/brucechamoff