SlideShare une entreprise Scribd logo
1  sur  19
1
A new way to develop with
WordPress!
2
1. Introduction
2. Classic WordPress workflow
3. The Composer way
a. Overview
b. Integrating with WordPress
c. WordPress Packagist
4. Enter Bedrock
a. Overview
b. Working on your project
c. PhpDotEnv
d. Deploying your project
e. Multisite
5. Theming with Twig and Timber
a. Overview
b. Templating files
c. Bonus (Debug bar)
Table of content
6. Developing plugins with Herbert
a. Overview
b. Basis
7. References
3
A report on 1 july 2016 suggest
that WordPress powers
26.6% of the internet.
Introduction
4
How to?
1. Download WordPress
2. Push WordPress using FTP
3. Install WordPress (generate wp-config.php)
4. Install plugins/themes using FTP or backend
5. Update manually plugins/themes
Classic WordPress workflow
Issues
1. Updating WordPress/plugins can break site
2. Manually keep track of WordPress and
plugins/themes versions (on Git)
3. Deploys can be cumbersome (hours)
4. Configuring WordPress in multiple environments
is difficult (wp-config.php, unversioned)
5
Tools
● Git
● Composer
● WordPress Packagist
Advantages
● Dependencies explicitly declared in a single place (composer.json)
● Installing/Updating handled by Composer
● Project locked onto specific versions
● Don’t need to include the actual 3rd party code in your version control repository
The Composer way: Overview
6
Dependencies
● WordPress itself
● Plugins
● Themes
● Private repos
Structure
The Composer way: Integrating with WordPress
Composer.json
➔ auto-updating fork (syncs every 15 minutes
with the official WP repo) that includes
composer.json
{
"require": {
"php": ">=5.4",
"johnpbloch/wordpress": "~4.5"
},
"extra": {
"wordpress-install-dir": "wp"
}
}
.
├── wp
├── wp-content
├── index.php
└── wp-config.php
➔ require johnpbloch/wordpress-core-installer
7
➔ Mirror of the WordPress plugin directory as a
Composer repository
The Composer way: WordPress Packagist
{
"extra": {
"installer-paths": {
"content/mu-plugins/{$name}/": [
"type:wordpress-muplugin"
],
"content/plugins/{$name}/": [
"type:wordpress-plugin"
],
"content/themes/{$name}/": [
"type:wordpress-theme"
]
}
}
}
{
"repositories": [
{
"type": "composer",
"url": "http://wpackagist.org"
}
]
}
1. Add the repository to your composer.json
2. Add the desired plugins and themes
3. Run
composer require wpackagist-plugin/contact-
form-7
Extra: customize installer paths
composer update
8
Features
● Better folder structure
● Dependency management with Composer
● Easy WordPress configuration with environment specific files
● Environment variables with Dotenv
● Autoloader for mu-plugins (use regular plugins as mu-plugins)
● Enhanced security (separated web root and secure passwords with wp-password-bcrypt)
Requirements
★ PHP >= 5.6
★ Composer
Enter Bedrock: Overview
9
Enter Bedrock: Working on your project
Installation
1. composer create-project roots/bedrock
2. Copy .env.example to .env
3. Vhost => /path/to/site/web/
4. http://example.com/wp/wp-admin
.
├── config
│ ├── application.php
│ └── environments
│ ├── development.php
│ ├── production.php
│ └── staging.php
├── vendor
├── web
│ ├── app
│ │ ├── mu-plugins
│ │ ├── plugins
│ │ ├── themes
│ │ └── uploads
│ ├── wp
│ └── wp-config.php
Folder structure of Bedrock
10
Configuration and environment variables
Enter Bedrock: PhpDotEnv
DB_NAME=database_name
DB_USER=database_user
DB_PASSWORD=database_password
DB_HOST=database_host
WP_ENV=development
WP_HOME=http://example.com
WP_SITEURL=${WP_HOME}/wp
# Generate your keys here: https://roots.io/salts.html
AUTH_KEY='generateme'
SECURE_AUTH_KEY='generateme'
LOGGED_IN_KEY='generateme'
NONCE_KEY='generateme'
AUTH_SALT='generateme'
SECURE_AUTH_SALT='generateme'
LOGGED_IN_SALT='generateme'
NONCE_SALT='generateme'
Stage Switcher
➔ A WordPress plugin that allows you to
switch between different environments
from the admin bar.
➔ https://roots.io/plugins/stage-switcher/
Installation
composer require roots/wp-stage-switcher
11
How to?
Enter Bedrock: Deploying your project
Migrating an existing project to Bedrock
1. Install Bedrock
2. Configure WordPress
3. Install plugins/themes with Composer
composer install
12
Features
● Better folder structure
● Dependency management with Composer
● Easy WordPress configuration with environment specific files
● Environment variables with Dotenv
● Autoloader for mu-plugins (use regular plugins as mu-plugins)
● Debug Bar plugin
● Developer plugin
● Stage Switcher plugin
● MultisiteDirectoryResolver: filters that correct directory paths
● Koodimonni composer lang support
Installation
Enter Bedrock: Multisite
composer create-project gwa-bedrock-multisite-
skeleton
13
Advantages Of Using A Templating Language
1. Concise
2. Template orientated
3. Full-featured
4. Easy to learn
5. Extensibility
6. Fast
Theming with Twig and Timber: Overview
Timber presentation
1. Integrates the Twig engine into WordPress
2. Creates a foundation WordPress data set
3. Handles the rendering of Twig templates
Installing Timber
composer require wpackagist-plugin/timber-
library
14
PHP files are only concerned with
collating the required data
Theming with Twig and Timber: Templating files
<?php
/**
* The main template file.
*/
// set up page data
$data = Timber::get_context();
$data['posts'] = Timber::get_posts();
$data['page'] = 'home';
// render using Twig template index.twig
Timber::render('twig/index.twig', $data);
{% extends 'twig/base.twig' %}
{% block content %}
<!-- start the loop -->
{% for post in posts %}
{{ include( 'twig/content.twig', ignore_missing = true )
}}
{% else %}
{{ include( 'twig/content-none.twig' ) }}
{% endfor %}
{% if posts %}{{ function( 'bosco_paging_nav' ) }}{% endif %}
{% endblock %}
Timber methods to get the generic data and then renders
the index.twig template
15
Let’s have a look at the base template
Theming with Twig and Timber: Templating files
{% import 'twig/macros.twig' as macros %}
{{ function( 'get_header' ) }}
<div id="primary" class="content-area">
<div id="main" class="site-main" role="main">
{% block content %}{% endblock %}
</div><!-- #main -->
</div><!-- #primary -->
{{ function( 'get_sidebar' ) }}
{{ function( 'get_footer' ) }}
OK, But PHP And Twig? Isn’t That Doubling-Up?
1. Checking is_singular
2. Checking page type:
a. is_single
b. is_page
c. is_home
d. is_category
e. is_tag
f. is_author
// render using Twig template index.twig
Timber::render('twig/' . $template . '.twig',
$data);
16
What is WordPress Debug Bar?
● debug menu to the admin bar
● Shows query, cache, other helpful
debugging information
How To install?
https://wordpress.org/plugins/debug-bar/
Theming with Twig and Timber: Bonus (Debug Bar)
What is Timber Debug Bar?
● current template name
● absolute location on your server
● full contents of the context
How To install?
https://wordpress.org/plugins/debug-bar-timber/
composer require wpackagist-plugin/debug-bar
composer require wpackagist-plugin/debug-bar-
timber
17
Overview
● OOP
● MVC
● Twig template engine
● Composer
● Laravel Eloquent ORM
Requirements
➔ PHP 5.4+
➔ WordPress 3.4+
Installation
Developing plugins with Herbert: Overview
composer require getherbert/herbert-plugin
Features
● Config
● Routes
● Panels
● Enqueue (JS + CSS scripts)
● Helper
● Controllers
● Views
● Input (GET; POST)
● API
● Shortcodes
● Activate & Deactivate
● Messages (notifications)
● Widgets
● Saving data (Eloquent ORM)
● Custom Post Types
18
Naming your Plugin
Developing plugins with Herbert: Basis
.
├── app
│ ├── Helper.php
│ ├── api.php
│ ├── enqueue.php
│ ├── panels.php
│ ├── routes.php
│ ├── shortcodes.php
│ └── widgets.php
├── resources
│ ├── assets
│ └── views
├── composer.json
├── herbert.config.php
└── plugin.php
/**
* @wordpress-plugin
* Plugin Name: My Plugin
* Plugin URI: http://plugin-name.com/
* Description: A plugin.
* Version: 1.0.0
* Author: Author
* Author URI: http://author.com/
* License: MIT
*/
Folder structure of your Plugin
19
● https://roots.io/using-composer-with-wordpress/
● https://roots.io/bedrock/
● https://roots.io/bedrock/docs/
● https://roots.io/plugins/stage-switcher/
● https://css-tricks.com/intro-bedrock-wordpress/
● https://premium.wpmudev.org/blog/simplify-your-wordpress-theming-with-twig-and-timber/
● http://getherbert.com
● https://github.com/studio24/wordpress-multi-env-config
References

Contenu connexe

Tendances

Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101hendrikvb
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Shinya Ohyanagi
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojobpmedley
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHPThomas Weinert
 
Asynchronous I/O in PHP
Asynchronous I/O in PHPAsynchronous I/O in PHP
Asynchronous I/O in PHPThomas Weinert
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Redis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationRedis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationrjsmelo
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5Wim Godden
 
Php 7 hhvm and co
Php 7 hhvm and coPhp 7 hhvm and co
Php 7 hhvm and coPierre Joye
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)julien pauli
 
ekb.py - Python VS ...
ekb.py - Python VS ...ekb.py - Python VS ...
ekb.py - Python VS ...it-people
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsMark Baker
 
React PHP: the NodeJS challenger
React PHP: the NodeJS challengerReact PHP: the NodeJS challenger
React PHP: the NodeJS challengervanphp
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13julien pauli
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6Wim Godden
 
Cli the other SAPI confoo11
Cli the other SAPI confoo11Cli the other SAPI confoo11
Cli the other SAPI confoo11Combell NV
 

Tendances (20)

Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101Web Apps in Perl - HTTP 101
Web Apps in Perl - HTTP 101
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
PHP5.5 is Here
PHP5.5 is HerePHP5.5 is Here
PHP5.5 is Here
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHP
 
Asynchronous I/O in PHP
Asynchronous I/O in PHPAsynchronous I/O in PHP
Asynchronous I/O in PHP
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Redis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationRedis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your application
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
 
Php 7 hhvm and co
Php 7 hhvm and coPhp 7 hhvm and co
Php 7 hhvm and co
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
 
ekb.py - Python VS ...
ekb.py - Python VS ...ekb.py - Python VS ...
ekb.py - Python VS ...
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
New in php 7
New in php 7New in php 7
New in php 7
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensions
 
React PHP: the NodeJS challenger
React PHP: the NodeJS challengerReact PHP: the NodeJS challenger
React PHP: the NodeJS challenger
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
groovy & grails - lecture 2
groovy & grails - lecture 2groovy & grails - lecture 2
groovy & grails - lecture 2
 
Cli the other SAPI confoo11
Cli the other SAPI confoo11Cli the other SAPI confoo11
Cli the other SAPI confoo11
 

En vedette

Presentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStackPresentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStackDavid Sanchez
 
Prot. 121 17 pl autoriza o poder executivo municipal a realizar obras de p...
Prot. 121 17   pl  autoriza o poder executivo municipal a realizar obras de p...Prot. 121 17   pl  autoriza o poder executivo municipal a realizar obras de p...
Prot. 121 17 pl autoriza o poder executivo municipal a realizar obras de p...Claudio Figueiredo
 
Licencia creative commons - TI4
Licencia creative commons - TI4Licencia creative commons - TI4
Licencia creative commons - TI4tatisaleja
 
Ejemplo Impress
Ejemplo ImpressEjemplo Impress
Ejemplo Impressjfjaraiz
 
Презентация к открытому уроку
Презентация к открытому урокуПрезентация к открытому уроку
Презентация к открытому урокуHanovaSveta
 
Trabajo individual quidam
Trabajo individual quidamTrabajo individual quidam
Trabajo individual quidamLaura Armo
 
Cross-Cultural Competence - CLS
Cross-Cultural Competence - CLSCross-Cultural Competence - CLS
Cross-Cultural Competence - CLSGbolahan Olarewaju
 
TI Quidam / José Alejandro Brescia Sellés
TI Quidam / José Alejandro Brescia SellésTI Quidam / José Alejandro Brescia Sellés
TI Quidam / José Alejandro Brescia SellésChechi Brescia
 
Presentation @ #cesicon 2017 on the Provision of Computer Science in Upper Se...
Presentation @ #cesicon 2017 on the Provision of Computer Science in Upper Se...Presentation @ #cesicon 2017 on the Provision of Computer Science in Upper Se...
Presentation @ #cesicon 2017 on the Provision of Computer Science in Upper Se...Neil Keane
 
Modern Control Matlab_Dr. Khaki Seddigh
Modern Control Matlab_Dr. Khaki SeddighModern Control Matlab_Dr. Khaki Seddigh
Modern Control Matlab_Dr. Khaki SeddighSomayeh Norouzi
 
Introduction To Mechanical Smoke Control CPD Presentation
Introduction To Mechanical Smoke Control CPD PresentationIntroduction To Mechanical Smoke Control CPD Presentation
Introduction To Mechanical Smoke Control CPD PresentationAxair Fan (UK) Ltd.
 

En vedette (20)

Presentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStackPresentation of Python, Django, DockerStack
Presentation of Python, Django, DockerStack
 
PHP 7
PHP 7PHP 7
PHP 7
 
Nouveautés php 7
Nouveautés php 7Nouveautés php 7
Nouveautés php 7
 
PHP 7 - Think php7
PHP 7 - Think php7PHP 7 - Think php7
PHP 7 - Think php7
 
Prot. 121 17 pl autoriza o poder executivo municipal a realizar obras de p...
Prot. 121 17   pl  autoriza o poder executivo municipal a realizar obras de p...Prot. 121 17   pl  autoriza o poder executivo municipal a realizar obras de p...
Prot. 121 17 pl autoriza o poder executivo municipal a realizar obras de p...
 
Licencia creative commons - TI4
Licencia creative commons - TI4Licencia creative commons - TI4
Licencia creative commons - TI4
 
Vaccines
VaccinesVaccines
Vaccines
 
Ejemplo Impress
Ejemplo ImpressEjemplo Impress
Ejemplo Impress
 
Презентация к открытому уроку
Презентация к открытому урокуПрезентация к открытому уроку
Презентация к открытому уроку
 
Trabajo individual quidam
Trabajo individual quidamTrabajo individual quidam
Trabajo individual quidam
 
Five key elements to create a culture of accountability
Five key elements to create a culture of accountabilityFive key elements to create a culture of accountability
Five key elements to create a culture of accountability
 
Cross-Cultural Competence - CLS
Cross-Cultural Competence - CLSCross-Cultural Competence - CLS
Cross-Cultural Competence - CLS
 
TI Quidam / José Alejandro Brescia Sellés
TI Quidam / José Alejandro Brescia SellésTI Quidam / José Alejandro Brescia Sellés
TI Quidam / José Alejandro Brescia Sellés
 
Presentation @ #cesicon 2017 on the Provision of Computer Science in Upper Se...
Presentation @ #cesicon 2017 on the Provision of Computer Science in Upper Se...Presentation @ #cesicon 2017 on the Provision of Computer Science in Upper Se...
Presentation @ #cesicon 2017 on the Provision of Computer Science in Upper Se...
 
Modern Control Matlab_Dr. Khaki Seddigh
Modern Control Matlab_Dr. Khaki SeddighModern Control Matlab_Dr. Khaki Seddigh
Modern Control Matlab_Dr. Khaki Seddigh
 
La segunda república española
La segunda república españolaLa segunda república española
La segunda república española
 
Introduction To Mechanical Smoke Control CPD Presentation
Introduction To Mechanical Smoke Control CPD PresentationIntroduction To Mechanical Smoke Control CPD Presentation
Introduction To Mechanical Smoke Control CPD Presentation
 
Introduce php7
Introduce php7Introduce php7
Introduce php7
 
What’s New in PHP7?
What’s New in PHP7?What’s New in PHP7?
What’s New in PHP7?
 
PHP7 e Rich Domain Model
PHP7 e Rich Domain ModelPHP7 e Rich Domain Model
PHP7 e Rich Domain Model
 

Similaire à A new way to develop with WordPress!

Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
 
Mastering WordPress Vol.1
Mastering WordPress Vol.1Mastering WordPress Vol.1
Mastering WordPress Vol.1Wataru OKAMOTO
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!David Gibbons
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Bastian Grimm
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsDECK36
 
Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Maurizio Pelizzone
 
WordPress Plugin Development 201
WordPress Plugin Development 201WordPress Plugin Development 201
WordPress Plugin Development 201ylefebvre
 
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017MarcinStachniuk
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentBrad Williams
 
WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern developmentRoman Veselý
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with DockerHanoiJUG
 
Serving Moodle Presentation
Serving Moodle PresentationServing Moodle Presentation
Serving Moodle Presentationwebhostingguy
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdevFrank Rousseau
 
Making environment for_infrastructure_as_code
Making environment for_infrastructure_as_codeMaking environment for_infrastructure_as_code
Making environment for_infrastructure_as_codeSoshi Nemoto
 
Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...Aleksey Tkachenko
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019Anam Ahmed
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress pluginAnthony Montalbano
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 

Similaire à A new way to develop with WordPress! (20)

Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Mastering WordPress Vol.1
Mastering WordPress Vol.1Mastering WordPress Vol.1
Mastering WordPress Vol.1
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
 
Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress
 
WordPress Plugin Development 201
WordPress Plugin Development 201WordPress Plugin Development 201
WordPress Plugin Development 201
 
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
Continuous Delivery w projekcie Open Source - Marcin Stachniuk - DevCrowd 2017
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern development
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with Docker
 
Serving Moodle Presentation
Serving Moodle PresentationServing Moodle Presentation
Serving Moodle Presentation
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
 
Making environment for_infrastructure_as_code
Making environment for_infrastructure_as_codeMaking environment for_infrastructure_as_code
Making environment for_infrastructure_as_code
 
Wordpress as a framework
Wordpress as a frameworkWordpress as a framework
Wordpress as a framework
 
vitepress-en.pdf
vitepress-en.pdfvitepress-en.pdf
vitepress-en.pdf
 
Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress plugin
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 

Dernier

Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 

Dernier (20)

Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 

A new way to develop with WordPress!

  • 1. 1 A new way to develop with WordPress!
  • 2. 2 1. Introduction 2. Classic WordPress workflow 3. The Composer way a. Overview b. Integrating with WordPress c. WordPress Packagist 4. Enter Bedrock a. Overview b. Working on your project c. PhpDotEnv d. Deploying your project e. Multisite 5. Theming with Twig and Timber a. Overview b. Templating files c. Bonus (Debug bar) Table of content 6. Developing plugins with Herbert a. Overview b. Basis 7. References
  • 3. 3 A report on 1 july 2016 suggest that WordPress powers 26.6% of the internet. Introduction
  • 4. 4 How to? 1. Download WordPress 2. Push WordPress using FTP 3. Install WordPress (generate wp-config.php) 4. Install plugins/themes using FTP or backend 5. Update manually plugins/themes Classic WordPress workflow Issues 1. Updating WordPress/plugins can break site 2. Manually keep track of WordPress and plugins/themes versions (on Git) 3. Deploys can be cumbersome (hours) 4. Configuring WordPress in multiple environments is difficult (wp-config.php, unversioned)
  • 5. 5 Tools ● Git ● Composer ● WordPress Packagist Advantages ● Dependencies explicitly declared in a single place (composer.json) ● Installing/Updating handled by Composer ● Project locked onto specific versions ● Don’t need to include the actual 3rd party code in your version control repository The Composer way: Overview
  • 6. 6 Dependencies ● WordPress itself ● Plugins ● Themes ● Private repos Structure The Composer way: Integrating with WordPress Composer.json ➔ auto-updating fork (syncs every 15 minutes with the official WP repo) that includes composer.json { "require": { "php": ">=5.4", "johnpbloch/wordpress": "~4.5" }, "extra": { "wordpress-install-dir": "wp" } } . ├── wp ├── wp-content ├── index.php └── wp-config.php ➔ require johnpbloch/wordpress-core-installer
  • 7. 7 ➔ Mirror of the WordPress plugin directory as a Composer repository The Composer way: WordPress Packagist { "extra": { "installer-paths": { "content/mu-plugins/{$name}/": [ "type:wordpress-muplugin" ], "content/plugins/{$name}/": [ "type:wordpress-plugin" ], "content/themes/{$name}/": [ "type:wordpress-theme" ] } } } { "repositories": [ { "type": "composer", "url": "http://wpackagist.org" } ] } 1. Add the repository to your composer.json 2. Add the desired plugins and themes 3. Run composer require wpackagist-plugin/contact- form-7 Extra: customize installer paths composer update
  • 8. 8 Features ● Better folder structure ● Dependency management with Composer ● Easy WordPress configuration with environment specific files ● Environment variables with Dotenv ● Autoloader for mu-plugins (use regular plugins as mu-plugins) ● Enhanced security (separated web root and secure passwords with wp-password-bcrypt) Requirements ★ PHP >= 5.6 ★ Composer Enter Bedrock: Overview
  • 9. 9 Enter Bedrock: Working on your project Installation 1. composer create-project roots/bedrock 2. Copy .env.example to .env 3. Vhost => /path/to/site/web/ 4. http://example.com/wp/wp-admin . ├── config │ ├── application.php │ └── environments │ ├── development.php │ ├── production.php │ └── staging.php ├── vendor ├── web │ ├── app │ │ ├── mu-plugins │ │ ├── plugins │ │ ├── themes │ │ └── uploads │ ├── wp │ └── wp-config.php Folder structure of Bedrock
  • 10. 10 Configuration and environment variables Enter Bedrock: PhpDotEnv DB_NAME=database_name DB_USER=database_user DB_PASSWORD=database_password DB_HOST=database_host WP_ENV=development WP_HOME=http://example.com WP_SITEURL=${WP_HOME}/wp # Generate your keys here: https://roots.io/salts.html AUTH_KEY='generateme' SECURE_AUTH_KEY='generateme' LOGGED_IN_KEY='generateme' NONCE_KEY='generateme' AUTH_SALT='generateme' SECURE_AUTH_SALT='generateme' LOGGED_IN_SALT='generateme' NONCE_SALT='generateme' Stage Switcher ➔ A WordPress plugin that allows you to switch between different environments from the admin bar. ➔ https://roots.io/plugins/stage-switcher/ Installation composer require roots/wp-stage-switcher
  • 11. 11 How to? Enter Bedrock: Deploying your project Migrating an existing project to Bedrock 1. Install Bedrock 2. Configure WordPress 3. Install plugins/themes with Composer composer install
  • 12. 12 Features ● Better folder structure ● Dependency management with Composer ● Easy WordPress configuration with environment specific files ● Environment variables with Dotenv ● Autoloader for mu-plugins (use regular plugins as mu-plugins) ● Debug Bar plugin ● Developer plugin ● Stage Switcher plugin ● MultisiteDirectoryResolver: filters that correct directory paths ● Koodimonni composer lang support Installation Enter Bedrock: Multisite composer create-project gwa-bedrock-multisite- skeleton
  • 13. 13 Advantages Of Using A Templating Language 1. Concise 2. Template orientated 3. Full-featured 4. Easy to learn 5. Extensibility 6. Fast Theming with Twig and Timber: Overview Timber presentation 1. Integrates the Twig engine into WordPress 2. Creates a foundation WordPress data set 3. Handles the rendering of Twig templates Installing Timber composer require wpackagist-plugin/timber- library
  • 14. 14 PHP files are only concerned with collating the required data Theming with Twig and Timber: Templating files <?php /** * The main template file. */ // set up page data $data = Timber::get_context(); $data['posts'] = Timber::get_posts(); $data['page'] = 'home'; // render using Twig template index.twig Timber::render('twig/index.twig', $data); {% extends 'twig/base.twig' %} {% block content %} <!-- start the loop --> {% for post in posts %} {{ include( 'twig/content.twig', ignore_missing = true ) }} {% else %} {{ include( 'twig/content-none.twig' ) }} {% endfor %} {% if posts %}{{ function( 'bosco_paging_nav' ) }}{% endif %} {% endblock %} Timber methods to get the generic data and then renders the index.twig template
  • 15. 15 Let’s have a look at the base template Theming with Twig and Timber: Templating files {% import 'twig/macros.twig' as macros %} {{ function( 'get_header' ) }} <div id="primary" class="content-area"> <div id="main" class="site-main" role="main"> {% block content %}{% endblock %} </div><!-- #main --> </div><!-- #primary --> {{ function( 'get_sidebar' ) }} {{ function( 'get_footer' ) }} OK, But PHP And Twig? Isn’t That Doubling-Up? 1. Checking is_singular 2. Checking page type: a. is_single b. is_page c. is_home d. is_category e. is_tag f. is_author // render using Twig template index.twig Timber::render('twig/' . $template . '.twig', $data);
  • 16. 16 What is WordPress Debug Bar? ● debug menu to the admin bar ● Shows query, cache, other helpful debugging information How To install? https://wordpress.org/plugins/debug-bar/ Theming with Twig and Timber: Bonus (Debug Bar) What is Timber Debug Bar? ● current template name ● absolute location on your server ● full contents of the context How To install? https://wordpress.org/plugins/debug-bar-timber/ composer require wpackagist-plugin/debug-bar composer require wpackagist-plugin/debug-bar- timber
  • 17. 17 Overview ● OOP ● MVC ● Twig template engine ● Composer ● Laravel Eloquent ORM Requirements ➔ PHP 5.4+ ➔ WordPress 3.4+ Installation Developing plugins with Herbert: Overview composer require getherbert/herbert-plugin Features ● Config ● Routes ● Panels ● Enqueue (JS + CSS scripts) ● Helper ● Controllers ● Views ● Input (GET; POST) ● API ● Shortcodes ● Activate & Deactivate ● Messages (notifications) ● Widgets ● Saving data (Eloquent ORM) ● Custom Post Types
  • 18. 18 Naming your Plugin Developing plugins with Herbert: Basis . ├── app │ ├── Helper.php │ ├── api.php │ ├── enqueue.php │ ├── panels.php │ ├── routes.php │ ├── shortcodes.php │ └── widgets.php ├── resources │ ├── assets │ └── views ├── composer.json ├── herbert.config.php └── plugin.php /** * @wordpress-plugin * Plugin Name: My Plugin * Plugin URI: http://plugin-name.com/ * Description: A plugin. * Version: 1.0.0 * Author: Author * Author URI: http://author.com/ * License: MIT */ Folder structure of your Plugin
  • 19. 19 ● https://roots.io/using-composer-with-wordpress/ ● https://roots.io/bedrock/ ● https://roots.io/bedrock/docs/ ● https://roots.io/plugins/stage-switcher/ ● https://css-tricks.com/intro-bedrock-wordpress/ ● https://premium.wpmudev.org/blog/simplify-your-wordpress-theming-with-twig-and-timber/ ● http://getherbert.com ● https://github.com/studio24/wordpress-multi-env-config References