SlideShare a Scribd company logo
WordPress (4.9.6)
● Go through the standard setup of WordPress
● Do a basic introduction of the admin dashboard
WP file permissions
chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} ; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} ; # Change file permissions rw-r--r--
https://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpr
ess
wp-config.php
if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
/** Declare Dev-mode for WordPress */
define( 'WP_LOCAL_DEV', true );
/** Include config for dev environment */
include( dirname( __FILE__ ) . '/local-config.php' );
}
else {
/** Load config from env */
define('DB_NAME', $_ENV['DB_NAME']);
}
wp-config.php
● Turn on/off magic using config
● Knowledge of different configs
https://codex.wordpress.org/Editing_wp-config.php
WP Plugin
A plugin is a package of code that is used to meet
the custom requirements.
● https://codex.wordpress.org/Plugin_API
● https://codex.wordpress.org/Writing_a_Plugin
Plugin Boilerplate
● https://github.com/DevinVinson/WordPress-Plugin
-Boilerplate
Start Theme
● WordPress default 2017 theme can be used
● Theme framework can be used if familiar
Standard theme signature
Theme Name: WordPress Classic
Theme URI: http://wordpress.org/
Description: The WordPress theme
Author: First Name
Author URI:
Tags: mantle color, variable width, two columns, widgets
Template: use-this-to-define-a-parent-theme
Version: 1.0
General comments/License Statement if any.
Theme structure
●
WP loop
Load JS/CSS in WP
function loadScriptWordPress()
{
// Deregister the included library
wp_deregister_script( 'jquery' );
// Register the library again from Google's CDN
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), null,
false );
// Register the script like this for a plugin:
wp_register_script( 'custom-script', plugins_url( '/js/custom-script.js', __FILE__ ), array( 'jquery' ) );
// or
// Register the script like this for a theme:
wp_register_script( 'custom-script', get_template_directory_uri() . '/js/custom-script.js', array( 'jquery' ) );
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script( 'custom-script' );
}
add_action( 'wp_enqueue_scripts', 'loadScriptWordPress' );
WP DB ERD
When to use WP_query(), query_posts() and
pre_get_posts
● query_posts() don't use query_posts() ever to modify main loop;
● get_posts() returns array of posts, doesn't modify global variables and is safe
to use anywhere;
● WP_Query safe to use anywhere.
https://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts
https://wordpress.stackexchange.com/questions/50761/when-to-use-wp-query-query-posts-and-pre-get-posts
When to use WP_query(), $wpdb
● $wpdb when we need to access our own
custom tables
● WP_Query when dealing with the native
WordPress tables.
WP DB alter
If we ever need to create or update database table using your
plugin we should use dbDelta
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
url varchar(55) DEFAULT '' NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
dbDelta( $sql );
https://codex.wordpress.org/Creating_Tables_with_Plugins
WP action hook
● Action hook does not return value
● A way to add custom code to WP core
● Inject content to response buffer
● Modify global variable state
WP filter hook
● Filter hook does return value
● Superset of action hook
WP shortcodes
● Shortcode is a special kind of content that can be
attached to any WP context and reused
function purchase_subscription( $atts, $content = null) {
$a = shortcode_atts( array('class' => 'green-btn'), $atts );
$content = ($content) ? $content : 'Buy';
return '<span class="'.$a['class'].'">' . $content . '</span>';
}
add_shortcode( 'purchasecode', 'purchase_subscription' );
[purchasecode class="gray-btn"]
[purchasecode class="gray-btn"]Purchase[/purchasecode]
WP post type
Default post types
● Post (Post Type: ‘post’)
● Page (Post Type: ‘page’)
● Attachment (Post Type: ‘attachment’)
● Revision (Post Type: ‘revision’)
● Navigation menu (Post Type: ‘nav_menu_item’)
Custom post types
We are allowed to create our own post types if the default post types are not matching with our requirements.
register_post_type( $post_type, $args );
https://codex.wordpress.org/Function_Reference/register_post_type
WP REST API
● Simple way to get data in and out of WordPress over HTTP
● A strong replacement for the admin-ajax API
● No PHP dependency, front-end can be anything
Endpoints:
http://<your-domain>/wp-json/wp/v2/posts
https://developer.wordpress.org/rest-api/reference/
Custom endpoints:
https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-end
points/
WP cache
● Cache is king on Web
● define('WP_CACHE', true);
● Expires ( GMT formatted date )
● Cache-Control ( public, max-age=60 )
● Etag ( Etag: "1edec-3e3073913b100" )
● Browser caching
● Server caching
WP cache
Tools
● https://gtmetrix.com
● https://developers.google.com/speed/pagespeed/insights
Plugins
1. https://wordpress.org/plugins/w3-total-cache/
2. https://wordpress.org/plugins/wp-super-cache/
Rules
3. https://developer.yahoo.com/performance/rules.html?guccounter=1
WP ajax
● In WordPress admin side JavaScript global variable ajaxurl can be used as
ajax with proper action
● On front-end we need to make our JavaScript aware of the admin-ajax.php
url.
add_action( 'wp_ajax_my_action', 'my_action' );
add_action( 'wp_ajax_nopriv_my_action', 'my_action' );
function my_action() {
// Do stuff
wp_die();
}
jQuery.post('admin-ajax.php', {'action': 'my_action', 'whatever': 1234}, function(response) {
console.log(response);
});
WP taxonomy
Taxonomy stands for grouping things and in WP it is for grouping contents.
Default Taxonomies
● Categropy
● Tag
● Link Category
● Post Formats
WordPress does have Custom Taxonomies
WP taxonomy
https://code.tutsplus.com/articles/introducing-wordpress-3-custom-taxonomies--net-11658
WP translation
● .pot “portable object template” contains all texts to be translated
● .po “portable object” contains the original text and the translations
● .mo “machine object file for WordPress
● Poedit tools that translates pot file to po and generates mo file
● Text Domain: woocommerce. Show example
● Text domain usage. _e( 'Your Ad here', 'my-text-domain' );
● Talk about translation plugins
https://codex.wordpress.org/I18n_for_WordPress_Developers
https://thethemefoundry.com/blog/translate-a-wordpress-theme/
Standard plugins
1. https://wordpress.org/plugins/w3-total-cache/
2. https://wordpress.org/plugins/akismet/
3. https://wordpress.org/plugins/google-sitemap-generator/
4. https://wordpress.org/plugins/contact-form-7/
5. https://wordpress.org/plugins/advanced-custom-fields/
6. https://wordpress.org/plugins/wordpress-seo/
7. https://wordpress.org/plugins/shareaholic/
8. https://wordpress.org/plugins/polylang/
Thank you

More Related Content

What's hot

Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress Way
Matt Wiebe
 
CI workflow in a web studio
CI workflow in a web studioCI workflow in a web studio
CI workflow in a web studio
deWeb
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
Sri Ram
 
Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet
Keir Bowden
 
WordPress CLI in-depth
WordPress CLI in-depthWordPress CLI in-depth
WordPress CLI in-depth
Sanjay Willie
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
GetSource
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
Caldera Labs
 
Common Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemCommon Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid Them
Acquia
 
Multi Tenancy With Python and Django
Multi Tenancy With Python and DjangoMulti Tenancy With Python and Django
Multi Tenancy With Python and Django
scottcrespo
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
Otto Kekäläinen
 
Tips for a Faster Website
Tips for a Faster WebsiteTips for a Faster Website
Tips for a Faster WebsiteRayed Alrashed
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
Puppet
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
topher1kenobe
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
LumoSpark
 
Getting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationGetting Into Drupal 8 Configuration
Getting Into Drupal 8 Configuration
Philip Norton
 
Ansible - Crash course
Ansible - Crash courseAnsible - Crash course
Ansible - Crash course
Simone Soldateschi
 
Deploying WP Multisite to Heroku
Deploying WP Multisite to HerokuDeploying WP Multisite to Heroku
Deploying WP Multisite to Heroku
Jussi Kinnula
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
Kumar Y
 

What's hot (20)

Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress Way
 
CI workflow in a web studio
CI workflow in a web studioCI workflow in a web studio
CI workflow in a web studio
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet
 
WordPress CLI in-depth
WordPress CLI in-depthWordPress CLI in-depth
WordPress CLI in-depth
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
 
Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
 
Common Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid ThemCommon Pitfalls for your Drupal Site, and How to Avoid Them
Common Pitfalls for your Drupal Site, and How to Avoid Them
 
Multi Tenancy With Python and Django
Multi Tenancy With Python and DjangoMulti Tenancy With Python and Django
Multi Tenancy With Python and Django
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
 
Tips for a Faster Website
Tips for a Faster WebsiteTips for a Faster Website
Tips for a Faster Website
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
 
Getting Into Drupal 8 Configuration
Getting Into Drupal 8 ConfigurationGetting Into Drupal 8 Configuration
Getting Into Drupal 8 Configuration
 
Generators
GeneratorsGenerators
Generators
 
Ansible - Crash course
Ansible - Crash courseAnsible - Crash course
Ansible - Crash course
 
Deploying WP Multisite to Heroku
Deploying WP Multisite to HerokuDeploying WP Multisite to Heroku
Deploying WP Multisite to Heroku
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 

Similar to A WordPress workshop at Cefalo

Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
Paul Bearne
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
Adam Tomat
 
Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013Think Media Inc.
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentTammy Hart
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
NGINX, Inc.
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
WP Engine
 
WordPress and The Command Line
WordPress and The Command LineWordPress and The Command Line
WordPress and The Command Line
Kelly Dwan
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Mike Schinkel
 
High performance WordPress
High performance WordPressHigh performance WordPress
High performance WordPress
Mikel King
 
Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)
jimyhuang
 
Getting Started With WordPress Development
Getting Started With WordPress DevelopmentGetting Started With WordPress Development
Getting Started With WordPress Development
Andy Brudtkuhl
 
How Not to Build a WordPress Plugin
How Not to Build a WordPress PluginHow Not to Build a WordPress Plugin
How Not to Build a WordPress PluginWill Norris
 
Как получить чёрный пояс по WordPress?
Как получить чёрный пояс по WordPress?Как получить чёрный пояс по WordPress?
Как получить чёрный пояс по WordPress?
Yevhen Kotelnytskyi
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
Caldera Labs
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin development
Mostafa Soufi
 
Drupal Deployment Troubles and Problems
Drupal Deployment Troubles and ProblemsDrupal Deployment Troubles and Problems
Drupal Deployment Troubles and Problems
Andrii Lundiak
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
Diana Thompson
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.com
InstaWP Inc
 
Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
Paul Bearne
 
PHP London Dec 2013 - Varnish - The 9 circles of hell
PHP London Dec 2013 - Varnish - The 9 circles of hellPHP London Dec 2013 - Varnish - The 9 circles of hell
PHP London Dec 2013 - Varnish - The 9 circles of hell
luis-ferro
 

Similar to A WordPress workshop at Cefalo (20)

Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 
Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
 
WordPress and The Command Line
WordPress and The Command LineWordPress and The Command Line
WordPress and The Command Line
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
High performance WordPress
High performance WordPressHigh performance WordPress
High performance WordPress
 
Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)
 
Getting Started With WordPress Development
Getting Started With WordPress DevelopmentGetting Started With WordPress Development
Getting Started With WordPress Development
 
How Not to Build a WordPress Plugin
How Not to Build a WordPress PluginHow Not to Build a WordPress Plugin
How Not to Build a WordPress Plugin
 
Как получить чёрный пояс по WordPress?
Как получить чёрный пояс по WordPress?Как получить чёрный пояс по WordPress?
Как получить чёрный пояс по WordPress?
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin development
 
Drupal Deployment Troubles and Problems
Drupal Deployment Troubles and ProblemsDrupal Deployment Troubles and Problems
Drupal Deployment Troubles and Problems
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.com
 
Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
 
PHP London Dec 2013 - Varnish - The 9 circles of hell
PHP London Dec 2013 - Varnish - The 9 circles of hellPHP London Dec 2013 - Varnish - The 9 circles of hell
PHP London Dec 2013 - Varnish - The 9 circles of hell
 

Recently uploaded

Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 

Recently uploaded (20)

Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 

A WordPress workshop at Cefalo

  • 1. WordPress (4.9.6) ● Go through the standard setup of WordPress ● Do a basic introduction of the admin dashboard
  • 2. WP file permissions chown www-data:www-data -R * # Let Apache be owner find . -type d -exec chmod 755 {} ; # Change directory permissions rwxr-xr-x find . -type f -exec chmod 644 {} ; # Change file permissions rw-r--r-- https://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpr ess
  • 3. wp-config.php if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) { /** Declare Dev-mode for WordPress */ define( 'WP_LOCAL_DEV', true ); /** Include config for dev environment */ include( dirname( __FILE__ ) . '/local-config.php' ); } else { /** Load config from env */ define('DB_NAME', $_ENV['DB_NAME']); }
  • 4. wp-config.php ● Turn on/off magic using config ● Knowledge of different configs https://codex.wordpress.org/Editing_wp-config.php
  • 5. WP Plugin A plugin is a package of code that is used to meet the custom requirements. ● https://codex.wordpress.org/Plugin_API ● https://codex.wordpress.org/Writing_a_Plugin
  • 7. Start Theme ● WordPress default 2017 theme can be used ● Theme framework can be used if familiar
  • 8. Standard theme signature Theme Name: WordPress Classic Theme URI: http://wordpress.org/ Description: The WordPress theme Author: First Name Author URI: Tags: mantle color, variable width, two columns, widgets Template: use-this-to-define-a-parent-theme Version: 1.0 General comments/License Statement if any.
  • 10.
  • 12. Load JS/CSS in WP function loadScriptWordPress() { // Deregister the included library wp_deregister_script( 'jquery' ); // Register the library again from Google's CDN wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), null, false ); // Register the script like this for a plugin: wp_register_script( 'custom-script', plugins_url( '/js/custom-script.js', __FILE__ ), array( 'jquery' ) ); // or // Register the script like this for a theme: wp_register_script( 'custom-script', get_template_directory_uri() . '/js/custom-script.js', array( 'jquery' ) ); // For either a plugin or a theme, you can then enqueue the script: wp_enqueue_script( 'custom-script' ); } add_action( 'wp_enqueue_scripts', 'loadScriptWordPress' );
  • 14. When to use WP_query(), query_posts() and pre_get_posts ● query_posts() don't use query_posts() ever to modify main loop; ● get_posts() returns array of posts, doesn't modify global variables and is safe to use anywhere; ● WP_Query safe to use anywhere. https://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts https://wordpress.stackexchange.com/questions/50761/when-to-use-wp-query-query-posts-and-pre-get-posts
  • 15. When to use WP_query(), $wpdb ● $wpdb when we need to access our own custom tables ● WP_Query when dealing with the native WordPress tables.
  • 16. WP DB alter If we ever need to create or update database table using your plugin we should use dbDelta $sql = "CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, url varchar(55) DEFAULT '' NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; dbDelta( $sql ); https://codex.wordpress.org/Creating_Tables_with_Plugins
  • 17. WP action hook ● Action hook does not return value ● A way to add custom code to WP core ● Inject content to response buffer ● Modify global variable state
  • 18. WP filter hook ● Filter hook does return value ● Superset of action hook
  • 19. WP shortcodes ● Shortcode is a special kind of content that can be attached to any WP context and reused function purchase_subscription( $atts, $content = null) { $a = shortcode_atts( array('class' => 'green-btn'), $atts ); $content = ($content) ? $content : 'Buy'; return '<span class="'.$a['class'].'">' . $content . '</span>'; } add_shortcode( 'purchasecode', 'purchase_subscription' ); [purchasecode class="gray-btn"] [purchasecode class="gray-btn"]Purchase[/purchasecode]
  • 20. WP post type Default post types ● Post (Post Type: ‘post’) ● Page (Post Type: ‘page’) ● Attachment (Post Type: ‘attachment’) ● Revision (Post Type: ‘revision’) ● Navigation menu (Post Type: ‘nav_menu_item’) Custom post types We are allowed to create our own post types if the default post types are not matching with our requirements. register_post_type( $post_type, $args ); https://codex.wordpress.org/Function_Reference/register_post_type
  • 21. WP REST API ● Simple way to get data in and out of WordPress over HTTP ● A strong replacement for the admin-ajax API ● No PHP dependency, front-end can be anything Endpoints: http://<your-domain>/wp-json/wp/v2/posts https://developer.wordpress.org/rest-api/reference/ Custom endpoints: https://developer.wordpress.org/rest-api/extending-the-rest-api/adding-custom-end points/
  • 22. WP cache ● Cache is king on Web ● define('WP_CACHE', true); ● Expires ( GMT formatted date ) ● Cache-Control ( public, max-age=60 ) ● Etag ( Etag: "1edec-3e3073913b100" ) ● Browser caching ● Server caching
  • 23. WP cache Tools ● https://gtmetrix.com ● https://developers.google.com/speed/pagespeed/insights Plugins 1. https://wordpress.org/plugins/w3-total-cache/ 2. https://wordpress.org/plugins/wp-super-cache/ Rules 3. https://developer.yahoo.com/performance/rules.html?guccounter=1
  • 24. WP ajax ● In WordPress admin side JavaScript global variable ajaxurl can be used as ajax with proper action ● On front-end we need to make our JavaScript aware of the admin-ajax.php url. add_action( 'wp_ajax_my_action', 'my_action' ); add_action( 'wp_ajax_nopriv_my_action', 'my_action' ); function my_action() { // Do stuff wp_die(); } jQuery.post('admin-ajax.php', {'action': 'my_action', 'whatever': 1234}, function(response) { console.log(response); });
  • 25. WP taxonomy Taxonomy stands for grouping things and in WP it is for grouping contents. Default Taxonomies ● Categropy ● Tag ● Link Category ● Post Formats WordPress does have Custom Taxonomies
  • 27. WP translation ● .pot “portable object template” contains all texts to be translated ● .po “portable object” contains the original text and the translations ● .mo “machine object file for WordPress ● Poedit tools that translates pot file to po and generates mo file ● Text Domain: woocommerce. Show example ● Text domain usage. _e( 'Your Ad here', 'my-text-domain' ); ● Talk about translation plugins https://codex.wordpress.org/I18n_for_WordPress_Developers https://thethemefoundry.com/blog/translate-a-wordpress-theme/
  • 28. Standard plugins 1. https://wordpress.org/plugins/w3-total-cache/ 2. https://wordpress.org/plugins/akismet/ 3. https://wordpress.org/plugins/google-sitemap-generator/ 4. https://wordpress.org/plugins/contact-form-7/ 5. https://wordpress.org/plugins/advanced-custom-fields/ 6. https://wordpress.org/plugins/wordpress-seo/ 7. https://wordpress.org/plugins/shareaholic/ 8. https://wordpress.org/plugins/polylang/