SlideShare une entreprise Scribd logo
1  sur  21
WordPress Beirut 15th Meetup - August
Build a Theme
fb.com/wpbeirut
wpbeirut.org
WhatsApp Group
Fadi Zahhar
Modern Full-
Stack Developer
Build A ThemeWhat we need
● Development
environment.
● A clean wordpress
installation
● A good text editor
(sublime, Visual Studio)
● Professionals use Cloud9
Minimum FilesTo start we need
● Style.css
● index.php
style.css
/*
Theme Name: Build a Theme - Wordpress Beirut
Theme URI: https://github.com/wpbeirut/build-a-theme/
Description: Theme 15th meetup Advanced Theme Templates.
Author: Wordpress Beirut Community Members
Author URI: https://github.com/wpbeirut
Version: 1.0
Text Domain: wpbeirut
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
Minimum Files
To start we need
● Style.css
● index.php
index.php
<?php
/* The main index file */
?>
<?php get_header(); ?>
<div class="main">
<div id="content" class="two-thirds left">
<?php get_template_part(
'includes/loop' ); ?>
</div><!-- #content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
More Theme FilesOther Files not least
● Header.php
● Footer.php
● Sidebar.php
● Archive.php
● Single.php
● Page.php
● Functions.php
get_header() will call the Header.php
get_sidebar() will call the sidebar.php
get_footer() will call the footer.php
Methods need to be calledWhat is important in
● Header.php
<?php bloginfo( 'stylesheet_url' ); ?>
<?php wp_head(); ?>
<?php echo site_url( '/' ); ?>
<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>
<?php bloginfo( 'name' ); ?>
<?php bloginfo( 'description' ); ?>
<?php esc_attr_e( 'Skip to content', ‘wpbeirut’); ?>
<?php _e( 'Skip to content', ‘wpbeirut’); ?>
Methods need to be called
What is important in
● Footer.php <?php if ( is_active_sidebar( 'first-footer-widget-area' ) ) { ?>
<div class="one-third left widget-area first">
<?php dynamic_sidebar( 'first-footer-widget-area' ); ?>
</div><!-- .first .widget-area -->
<?php } ?>
<?php if ( is_active_sidebar( 'second-footer-widget-area' ) ) { ?>
<div class="one-third left widget-area second">
<?php dynamic_sidebar( 'second-footer-widget-area' ); ?>
</div><!-- .second .widget-area -->
<?php } ?>
<?php if ( is_active_sidebar( 'third-footer-widget-area' ) ) { ?>
<div class="one-third left widget-area third">
<?php dynamic_sidebar( 'third-footer-widget-area' ); ?>
</div><!-- .third .widget-area -->
<?php } ?>
<?php wp_footer(); ?>
Methods need to be calledWhat is important in
● Sidebar.php
<?php if ( is_active_sidebar( 'sidebar-widget-area' ) ) { ?>
<aside class="widget-area">
<?php dynamic_sidebar( 'sidebar-widget-
area' ); ?>
</aside>
<?php } //end of conditional content ?>
Methods need to be calledWhat is important in
● functions.php
/* The theme functions file */
/***************************************************************************
*
Theme setup
****************************************************************************
/
/***************************************************************************
*
Register widgets
****************************************************************************
/
/***************************************************************************
*
Register custom post type
Theme Setup
What is important in
● functions.php
function wpbeirut_theme_setup() {
// title tags
add_theme_support( 'title-tag' );
// translation
load_theme_textdomain( 'wpbeirut', get_stylesheet_directory() .
'/languages' );
// post formats
add_theme_support( 'post_formats' );
// Post thumbnails or featured images
add_theme_support( 'post-thumbnails', array( 'post', 'page',
'wpbeirut_book' ) );
// RSS feed links to head
add_theme_support( 'automatic-feed-links' );
// navigation menu
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'wpbeirut' )
) );
}
add_action( 'after_setup_theme', 'wpbeirut_theme_setup' );
Register Widget
What is important in
● functions.php
function wpbeirut_register_widgets() {
// Sidebar widget area, located in the sidebar. Empty by default.
register_sidebar( array(
'name' => __( 'Sidebar Widget Area', 'tutsplus' ),
'id' => 'sidebar-widget-area',
'description' => __( 'The sidebar widget area', 'tutsplus' ),
'before_widget' => '<div id="%1$s" class="widget-
container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'wpbeirut_register_widgets' );
Register Widget
What is important in
● functions.php
function wpbeirut_register_post_type() {
// books
$labels = array(
'name' => __( 'Books' ),
'singular_name' => __( 'Books' ),
'add_new' => __( 'New Book' ),
'add_new_item' => __( 'Add New Book' ),
'edit_item' => __( 'Edit Book' ),
'new_item' => __( 'New Book' ),
'view_item' => __( 'View Book' ),
'search_items' => __( 'Search Books' ),
'not_found' => __( 'No Books Found' ),
'not_found_in_trash' => __( 'No Books found in Trash' ),
);
$args = array(
'labels' => $labels,
'has_archive' => true,
'public' => true,
'hierarchical' => false,
'supports' => array(
'title',
'editor',
'thumbnail',
'excerpt',
'custom-fields',
'page-attributes'
),
'taxonomies' => array( 'category' ),
'rewrite' => array( 'slug' => 'book' ),
);
register_post_type( 'wpbeirut_book', $args );
}
add_action( 'init', 'wpbeirut_register_post_type' );
Register Custom Taxonomy
What is important in
● functions.php
function wpbeirut_register_taxonomy() {
// genres
$labels = array(
'name' => __( 'Genres' ),
'singular_name' => __( 'Genre' ),
'search_items' => __( 'Search Genres' ),
'all_items' => __( 'All Genres' ),
'edit_item' => __( 'Edit Genres' ),
'update_item' => __( 'Update Genres' ),
'add_new_item' => __( 'Add New Genres' ),
'new_item_name' => __( 'New Genre Name' ),
'menu_name' => __( 'Genres' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'sort' => true,
'args' => array( 'orderby' => 'term_order' ),
'rewrite' => array( 'slug' => 'genre' ),
'show_admin_column' => true
);
The Single.phpWhat is important in
● Single.php is dedicated to posts
and posts types in wordpress.
● You can find a condition to
check if the post type is a
custom post type or regular post
type to render the correct loop.
<?php
if( is_singular( 'wpbeirut_book' ) ) {
get_template_part(
'includes/loop', 'book' );
}
else {
get_template_part(
'includes/loop', 'single' );
}
?>
The Page.phpWhat is important in
● Page.php is the page that is
dedicated to render the dynamic
pages of wordpress and not post
or post type.
<?php get_template_part( 'includes/loop', 'page'
); ?>
Hierarchy Concept
Hierarchy and others
● Archives.php
● Comments.php
● Contact-page.php
● You can find more details about
how to use files names for
theme development on the
following link
https://developer.wordpress.org
/themes/basics/template-
hierarchy/
Orientation and the loopOrientation
● For wordpress loops it is
best to put all loops in a
seperate folder known as
includes
● You can write one loop
and extend it by copy
paste and rename each
loop by it purpose
Loop.php
Loop-archive.php
Loop-book.php
Loop-genre.php
Loop-page.php
loop-single.php
Let us start our demoLet us start
Questions?
Thank You.

Contenu connexe

Tendances

Theme like a monster #ddceu
Theme like a monster #ddceuTheme like a monster #ddceu
Theme like a monster #ddceuMarek Sotak
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017Amanda Giles
 
Atomicant Drupal 6 Theming
Atomicant Drupal 6 ThemingAtomicant Drupal 6 Theming
Atomicant Drupal 6 ThemingMarek Sotak
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyBalázs Tatár
 
Shortcodes In-Depth
Shortcodes In-DepthShortcodes In-Depth
Shortcodes In-DepthMicah Wood
 
Drupal 7 Theming - what's new
Drupal 7 Theming - what's newDrupal 7 Theming - what's new
Drupal 7 Theming - what's newMarek Sotak
 
Let's write secure drupal code!
Let's write secure drupal code!Let's write secure drupal code!
Let's write secure drupal code!Balázs Tatár
 
WordPress Theme Workshop: Sidebars
WordPress Theme Workshop: SidebarsWordPress Theme Workshop: Sidebars
WordPress Theme Workshop: SidebarsDavid Bisset
 
Routing System In Symfony 1.2
Routing System In Symfony 1.2Routing System In Symfony 1.2
Routing System In Symfony 1.2Alex Demchenko
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with ExtbaseJochen Rau
 
Андрей Юртаев - Improve theming with (Twitter) Bootstrap
Андрей Юртаев - Improve theming with (Twitter) BootstrapАндрей Юртаев - Improve theming with (Twitter) Bootstrap
Андрей Юртаев - Improve theming with (Twitter) BootstrapDrupalSPB
 
Adopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal wayAdopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal wayMarek Sotak
 
i18n for Plugin and Theme Developers, WordCamp Milano 2016
i18n for Plugin and Theme Developers, WordCamp Milano 2016i18n for Plugin and Theme Developers, WordCamp Milano 2016
i18n for Plugin and Theme Developers, WordCamp Milano 2016Sergey Biryukov
 
DBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちDBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちRyo Miyake
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First WidgetChris Wilcoxson
 

Tendances (20)

Theme like a monster #ddceu
Theme like a monster #ddceuTheme like a monster #ddceu
Theme like a monster #ddceu
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
Atomicant Drupal 6 Theming
Atomicant Drupal 6 ThemingAtomicant Drupal 6 Theming
Atomicant Drupal 6 Theming
 
Keeping It Simple
Keeping It SimpleKeeping It Simple
Keeping It Simple
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
 
Smarty Template Engine
Smarty Template EngineSmarty Template Engine
Smarty Template Engine
 
Shortcodes In-Depth
Shortcodes In-DepthShortcodes In-Depth
Shortcodes In-Depth
 
Drupal 7 Theming - what's new
Drupal 7 Theming - what's newDrupal 7 Theming - what's new
Drupal 7 Theming - what's new
 
Let's write secure drupal code!
Let's write secure drupal code!Let's write secure drupal code!
Let's write secure drupal code!
 
WordPress Theme Workshop: Sidebars
WordPress Theme Workshop: SidebarsWordPress Theme Workshop: Sidebars
WordPress Theme Workshop: Sidebars
 
Routing System In Symfony 1.2
Routing System In Symfony 1.2Routing System In Symfony 1.2
Routing System In Symfony 1.2
 
Add loop shortcode
Add loop shortcodeAdd loop shortcode
Add loop shortcode
 
Get into the FLOW with Extbase
Get into the FLOW with ExtbaseGet into the FLOW with Extbase
Get into the FLOW with Extbase
 
Андрей Юртаев - Improve theming with (Twitter) Bootstrap
Андрей Юртаев - Improve theming with (Twitter) BootstrapАндрей Юртаев - Improve theming with (Twitter) Bootstrap
Андрей Юртаев - Improve theming with (Twitter) Bootstrap
 
Adopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal wayAdopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal way
 
Php My Sql
Php My SqlPhp My Sql
Php My Sql
 
Wp meetup custom post types
Wp meetup custom post typesWp meetup custom post types
Wp meetup custom post types
 
i18n for Plugin and Theme Developers, WordCamp Milano 2016
i18n for Plugin and Theme Developers, WordCamp Milano 2016i18n for Plugin and Theme Developers, WordCamp Milano 2016
i18n for Plugin and Theme Developers, WordCamp Milano 2016
 
DBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たちDBIx::Skinnyと仲間たち
DBIx::Skinnyと仲間たち
 
Building Your First Widget
Building Your First WidgetBuilding Your First Widget
Building Your First Widget
 

Similaire à WordPress 15th Meetup - Build a Theme

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
 
How to make a WordPress theme
How to make a WordPress themeHow to make a WordPress theme
How to make a WordPress themeHardeep Asrani
 
WordPress plugin #3
WordPress plugin #3WordPress plugin #3
WordPress plugin #3giwoolee
 
Drupal vs WordPress
Drupal vs WordPressDrupal vs WordPress
Drupal vs WordPressWalter Ebert
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1Yoav Farhi
 
WordPress for developers - phpday 2011
WordPress for developers -  phpday 2011WordPress for developers -  phpday 2011
WordPress for developers - phpday 2011Maurizio Pelizzone
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkDirk Haun
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentBrad Williams
 
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクトWordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクトHiromichi Koga
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin developmentMostafa Soufi
 
Various Ways of Using WordPress
Various Ways of Using WordPressVarious Ways of Using WordPress
Various Ways of Using WordPressNick La
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practicesmarkparolisi
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
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
 
Building a Portfolio With Custom Post Types
Building a Portfolio With Custom Post TypesBuilding a Portfolio With Custom Post Types
Building a Portfolio With Custom Post TypesAlex Blackie
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress WebsitesKyle Cearley
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress sitereferences
 

Similaire à WordPress 15th Meetup - Build a Theme (20)

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
 
How to make a WordPress theme
How to make a WordPress themeHow to make a WordPress theme
How to make a WordPress theme
 
WordPress plugin #3
WordPress plugin #3WordPress plugin #3
WordPress plugin #3
 
Drupal vs WordPress
Drupal vs WordPressDrupal vs WordPress
Drupal vs WordPress
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1
 
WordPress for developers - phpday 2011
WordPress for developers -  phpday 2011WordPress for developers -  phpday 2011
WordPress for developers - phpday 2011
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクトWordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin development
 
Various Ways of Using WordPress
Various Ways of Using WordPressVarious Ways of Using WordPress
Various Ways of Using WordPress
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
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
 
Building a Portfolio With Custom Post Types
Building a Portfolio With Custom Post TypesBuilding a Portfolio With Custom Post Types
Building a Portfolio With Custom Post Types
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 
20110820 header new style
20110820 header new style20110820 header new style
20110820 header new style
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress site
 

Plus de Fadi Nicolas Zahhar

Word press beirut 23st meetup may
Word press beirut 23st meetup   mayWord press beirut 23st meetup   may
Word press beirut 23st meetup mayFadi Nicolas Zahhar
 
Wordpress beirut 22th meetup april
Wordpress beirut 22th meetup   aprilWordpress beirut 22th meetup   april
Wordpress beirut 22th meetup aprilFadi Nicolas Zahhar
 
Word press beirut 21st meetup march
Word press beirut 21st meetup   marchWord press beirut 21st meetup   march
Word press beirut 21st meetup marchFadi Nicolas Zahhar
 
Wordpress Beirut 21th meetup February
Wordpress Beirut 21th meetup   FebruaryWordpress Beirut 21th meetup   February
Wordpress Beirut 21th meetup FebruaryFadi Nicolas Zahhar
 
Word press beirut 19th meetup January 2019
Word press beirut 19th meetup   January 2019Word press beirut 19th meetup   January 2019
Word press beirut 19th meetup January 2019Fadi Nicolas Zahhar
 
The Hiking Calendar - Christian Hölzl
 The Hiking Calendar - Christian Hölzl The Hiking Calendar - Christian Hölzl
The Hiking Calendar - Christian HölzlFadi Nicolas Zahhar
 
Word press beirut December 4 Meetup - Gutenberg VS WP-Bakery
Word press beirut December 4 Meetup - Gutenberg VS WP-Bakery Word press beirut December 4 Meetup - Gutenberg VS WP-Bakery
Word press beirut December 4 Meetup - Gutenberg VS WP-Bakery Fadi Nicolas Zahhar
 
Word press beirut 17th meetup october
Word press beirut 17th meetup   octoberWord press beirut 17th meetup   october
Word press beirut 17th meetup octoberFadi Nicolas Zahhar
 
WordPress Beirut 16th meetup September
WordPress Beirut 16th meetup   SeptemberWordPress Beirut 16th meetup   September
WordPress Beirut 16th meetup SeptemberFadi Nicolas Zahhar
 
WordPress 15th Meetup - Build a Child Theme
WordPress 15th Meetup - Build a Child ThemeWordPress 15th Meetup - Build a Child Theme
WordPress 15th Meetup - Build a Child ThemeFadi Nicolas Zahhar
 
Word press beirut 14th meetup July
Word press beirut 14th meetup JulyWord press beirut 14th meetup July
Word press beirut 14th meetup JulyFadi Nicolas Zahhar
 
14th Meetup WordPress Beirut - How WordPress helped us reach $200k in yearly ...
14th Meetup WordPress Beirut - How WordPress helped us reach $200k in yearly ...14th Meetup WordPress Beirut - How WordPress helped us reach $200k in yearly ...
14th Meetup WordPress Beirut - How WordPress helped us reach $200k in yearly ...Fadi Nicolas Zahhar
 
Wordpress Beirut understanding Gutenberg plugin
Wordpress Beirut understanding Gutenberg pluginWordpress Beirut understanding Gutenberg plugin
Wordpress Beirut understanding Gutenberg pluginFadi Nicolas Zahhar
 
Wordpress 15th Anniversary - Wordpress Beirut Community 13th Meetup June - 2018
Wordpress 15th Anniversary - Wordpress Beirut Community 13th Meetup  June - 2018Wordpress 15th Anniversary - Wordpress Beirut Community 13th Meetup  June - 2018
Wordpress 15th Anniversary - Wordpress Beirut Community 13th Meetup June - 2018Fadi Nicolas Zahhar
 
Word press beirut 12th meetup june
Word press beirut 12th meetup   juneWord press beirut 12th meetup   june
Word press beirut 12th meetup juneFadi Nicolas Zahhar
 
Word press beirut 11th meetup may
Word press beirut 11th meetup   mayWord press beirut 11th meetup   may
Word press beirut 11th meetup mayFadi Nicolas Zahhar
 

Plus de Fadi Nicolas Zahhar (20)

Wordpress deployment on aws
Wordpress deployment on awsWordpress deployment on aws
Wordpress deployment on aws
 
Word press beirut 23st meetup may
Word press beirut 23st meetup   mayWord press beirut 23st meetup   may
Word press beirut 23st meetup may
 
Wordpress beirut 22th meetup april
Wordpress beirut 22th meetup   aprilWordpress beirut 22th meetup   april
Wordpress beirut 22th meetup april
 
Choose a template
Choose a templateChoose a template
Choose a template
 
Word press beirut 21st meetup march
Word press beirut 21st meetup   marchWord press beirut 21st meetup   march
Word press beirut 21st meetup march
 
Wordpress Beirut 21th meetup February
Wordpress Beirut 21th meetup   FebruaryWordpress Beirut 21th meetup   February
Wordpress Beirut 21th meetup February
 
Word press beirut 19th meetup January 2019
Word press beirut 19th meetup   January 2019Word press beirut 19th meetup   January 2019
Word press beirut 19th meetup January 2019
 
Design for devs psych
Design for devs psychDesign for devs psych
Design for devs psych
 
The Hiking Calendar - Christian Hölzl
 The Hiking Calendar - Christian Hölzl The Hiking Calendar - Christian Hölzl
The Hiking Calendar - Christian Hölzl
 
Word press beirut December 4 Meetup - Gutenberg VS WP-Bakery
Word press beirut December 4 Meetup - Gutenberg VS WP-Bakery Word press beirut December 4 Meetup - Gutenberg VS WP-Bakery
Word press beirut December 4 Meetup - Gutenberg VS WP-Bakery
 
Word press beirut 17th meetup october
Word press beirut 17th meetup   octoberWord press beirut 17th meetup   october
Word press beirut 17th meetup october
 
WordPress Beirut 16th meetup September
WordPress Beirut 16th meetup   SeptemberWordPress Beirut 16th meetup   September
WordPress Beirut 16th meetup September
 
WordPress 15th Meetup - Build a Child Theme
WordPress 15th Meetup - Build a Child ThemeWordPress 15th Meetup - Build a Child Theme
WordPress 15th Meetup - Build a Child Theme
 
Embarking on your own journey
Embarking on your own journeyEmbarking on your own journey
Embarking on your own journey
 
Word press beirut 14th meetup July
Word press beirut 14th meetup JulyWord press beirut 14th meetup July
Word press beirut 14th meetup July
 
14th Meetup WordPress Beirut - How WordPress helped us reach $200k in yearly ...
14th Meetup WordPress Beirut - How WordPress helped us reach $200k in yearly ...14th Meetup WordPress Beirut - How WordPress helped us reach $200k in yearly ...
14th Meetup WordPress Beirut - How WordPress helped us reach $200k in yearly ...
 
Wordpress Beirut understanding Gutenberg plugin
Wordpress Beirut understanding Gutenberg pluginWordpress Beirut understanding Gutenberg plugin
Wordpress Beirut understanding Gutenberg plugin
 
Wordpress 15th Anniversary - Wordpress Beirut Community 13th Meetup June - 2018
Wordpress 15th Anniversary - Wordpress Beirut Community 13th Meetup  June - 2018Wordpress 15th Anniversary - Wordpress Beirut Community 13th Meetup  June - 2018
Wordpress 15th Anniversary - Wordpress Beirut Community 13th Meetup June - 2018
 
Word press beirut 12th meetup june
Word press beirut 12th meetup   juneWord press beirut 12th meetup   june
Word press beirut 12th meetup june
 
Word press beirut 11th meetup may
Word press beirut 11th meetup   mayWord press beirut 11th meetup   may
Word press beirut 11th meetup may
 

Dernier

Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jNeo4j
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideStefan Dietze
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?Paolo Missier
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 

Dernier (20)

Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 

WordPress 15th Meetup - Build a Theme

  • 1. WordPress Beirut 15th Meetup - August Build a Theme fb.com/wpbeirut wpbeirut.org WhatsApp Group
  • 3. Build A ThemeWhat we need ● Development environment. ● A clean wordpress installation ● A good text editor (sublime, Visual Studio) ● Professionals use Cloud9
  • 4. Minimum FilesTo start we need ● Style.css ● index.php style.css /* Theme Name: Build a Theme - Wordpress Beirut Theme URI: https://github.com/wpbeirut/build-a-theme/ Description: Theme 15th meetup Advanced Theme Templates. Author: Wordpress Beirut Community Members Author URI: https://github.com/wpbeirut Version: 1.0 Text Domain: wpbeirut License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html */
  • 5. Minimum Files To start we need ● Style.css ● index.php index.php <?php /* The main index file */ ?> <?php get_header(); ?> <div class="main"> <div id="content" class="two-thirds left"> <?php get_template_part( 'includes/loop' ); ?> </div><!-- #content --> <?php get_sidebar(); ?> <?php get_footer(); ?>
  • 6. More Theme FilesOther Files not least ● Header.php ● Footer.php ● Sidebar.php ● Archive.php ● Single.php ● Page.php ● Functions.php get_header() will call the Header.php get_sidebar() will call the sidebar.php get_footer() will call the footer.php
  • 7. Methods need to be calledWhat is important in ● Header.php <?php bloginfo( 'stylesheet_url' ); ?> <?php wp_head(); ?> <?php echo site_url( '/' ); ?> <?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?> <?php bloginfo( 'name' ); ?> <?php bloginfo( 'description' ); ?> <?php esc_attr_e( 'Skip to content', ‘wpbeirut’); ?> <?php _e( 'Skip to content', ‘wpbeirut’); ?>
  • 8. Methods need to be called What is important in ● Footer.php <?php if ( is_active_sidebar( 'first-footer-widget-area' ) ) { ?> <div class="one-third left widget-area first"> <?php dynamic_sidebar( 'first-footer-widget-area' ); ?> </div><!-- .first .widget-area --> <?php } ?> <?php if ( is_active_sidebar( 'second-footer-widget-area' ) ) { ?> <div class="one-third left widget-area second"> <?php dynamic_sidebar( 'second-footer-widget-area' ); ?> </div><!-- .second .widget-area --> <?php } ?> <?php if ( is_active_sidebar( 'third-footer-widget-area' ) ) { ?> <div class="one-third left widget-area third"> <?php dynamic_sidebar( 'third-footer-widget-area' ); ?> </div><!-- .third .widget-area --> <?php } ?> <?php wp_footer(); ?>
  • 9. Methods need to be calledWhat is important in ● Sidebar.php <?php if ( is_active_sidebar( 'sidebar-widget-area' ) ) { ?> <aside class="widget-area"> <?php dynamic_sidebar( 'sidebar-widget- area' ); ?> </aside> <?php } //end of conditional content ?>
  • 10. Methods need to be calledWhat is important in ● functions.php /* The theme functions file */ /*************************************************************************** * Theme setup **************************************************************************** / /*************************************************************************** * Register widgets **************************************************************************** / /*************************************************************************** * Register custom post type
  • 11. Theme Setup What is important in ● functions.php function wpbeirut_theme_setup() { // title tags add_theme_support( 'title-tag' ); // translation load_theme_textdomain( 'wpbeirut', get_stylesheet_directory() . '/languages' ); // post formats add_theme_support( 'post_formats' ); // Post thumbnails or featured images add_theme_support( 'post-thumbnails', array( 'post', 'page', 'wpbeirut_book' ) ); // RSS feed links to head add_theme_support( 'automatic-feed-links' ); // navigation menu register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'wpbeirut' ) ) ); } add_action( 'after_setup_theme', 'wpbeirut_theme_setup' );
  • 12. Register Widget What is important in ● functions.php function wpbeirut_register_widgets() { // Sidebar widget area, located in the sidebar. Empty by default. register_sidebar( array( 'name' => __( 'Sidebar Widget Area', 'tutsplus' ), 'id' => 'sidebar-widget-area', 'description' => __( 'The sidebar widget area', 'tutsplus' ), 'before_widget' => '<div id="%1$s" class="widget- container %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } add_action( 'widgets_init', 'wpbeirut_register_widgets' );
  • 13. Register Widget What is important in ● functions.php function wpbeirut_register_post_type() { // books $labels = array( 'name' => __( 'Books' ), 'singular_name' => __( 'Books' ), 'add_new' => __( 'New Book' ), 'add_new_item' => __( 'Add New Book' ), 'edit_item' => __( 'Edit Book' ), 'new_item' => __( 'New Book' ), 'view_item' => __( 'View Book' ), 'search_items' => __( 'Search Books' ), 'not_found' => __( 'No Books Found' ), 'not_found_in_trash' => __( 'No Books found in Trash' ), ); $args = array( 'labels' => $labels, 'has_archive' => true, 'public' => true, 'hierarchical' => false, 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'page-attributes' ), 'taxonomies' => array( 'category' ), 'rewrite' => array( 'slug' => 'book' ), ); register_post_type( 'wpbeirut_book', $args ); } add_action( 'init', 'wpbeirut_register_post_type' );
  • 14. Register Custom Taxonomy What is important in ● functions.php function wpbeirut_register_taxonomy() { // genres $labels = array( 'name' => __( 'Genres' ), 'singular_name' => __( 'Genre' ), 'search_items' => __( 'Search Genres' ), 'all_items' => __( 'All Genres' ), 'edit_item' => __( 'Edit Genres' ), 'update_item' => __( 'Update Genres' ), 'add_new_item' => __( 'Add New Genres' ), 'new_item_name' => __( 'New Genre Name' ), 'menu_name' => __( 'Genres' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'sort' => true, 'args' => array( 'orderby' => 'term_order' ), 'rewrite' => array( 'slug' => 'genre' ), 'show_admin_column' => true );
  • 15. The Single.phpWhat is important in ● Single.php is dedicated to posts and posts types in wordpress. ● You can find a condition to check if the post type is a custom post type or regular post type to render the correct loop. <?php if( is_singular( 'wpbeirut_book' ) ) { get_template_part( 'includes/loop', 'book' ); } else { get_template_part( 'includes/loop', 'single' ); } ?>
  • 16. The Page.phpWhat is important in ● Page.php is the page that is dedicated to render the dynamic pages of wordpress and not post or post type. <?php get_template_part( 'includes/loop', 'page' ); ?>
  • 17. Hierarchy Concept Hierarchy and others ● Archives.php ● Comments.php ● Contact-page.php ● You can find more details about how to use files names for theme development on the following link https://developer.wordpress.org /themes/basics/template- hierarchy/
  • 18. Orientation and the loopOrientation ● For wordpress loops it is best to put all loops in a seperate folder known as includes ● You can write one loop and extend it by copy paste and rename each loop by it purpose Loop.php Loop-archive.php Loop-book.php Loop-genre.php Loop-page.php loop-single.php
  • 19. Let us start our demoLet us start

Notes de l'éditeur

  1. No need to install the boilerplate on a working development environment. For the demo purposes we only need to clone the repository and edit the index.php by filling a table html and push it to the staging Before we push everything to the production. This is it.