SlideShare a Scribd company logo
1 of 46
Download to read offline
How to Make a WordPress Theme
Hardeep Asrani
Things we need to startโ€ฆ
โžค WordPress on your system.
โžค A good IDE.
โžค Starter ๏ฌles from Github:
โžค A basic/good knowledge of HTML, CSS and PHP.
Whatโ€™s a theme in WordPress?
Required Files
โžค style.css
โžค index.php
https://wphierarchy.com/
Functions of main files
โžค style.css
โžค index.php
โžค functions.php
โžค header.php
โžค footer.php
โžค single.php
โžค page.php
โžค comments.php
Enough gyaan, letโ€™s start coding.
Starter Content
โžค HTML Design: https://www.styleshout.com/free-templates/keep-it-simple/
โžค Workshop Content: https://github.com/HardeepAsrani/wp-massively
โžค Workshop Content has two folders, start and ๏ฌnished.
โžค We will use /start/ folder to make a theme.
โžค If you want to see the completed theme, you can see the /๏ฌnished/ theme.
1. Theme Info - style.css
/*
Theme Name: WP Massively
Theme URI: https://github.com/HardeepAsrani/wp-massively/
Author: Hardeep Asrani
Author URI: http://www.hardeepasrani.com
Description: A learning project for WordCamp Singapore.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wp-massively
Tags: blog, custom-logo, one-column, two-columns, custom-backgroundโ€ฆ
*/
/* Rest of your CSS goes here. */
2. Initial index.php
<?php get_header(); ?>
<?php // Rest of your content goes here. ?>
<?php get_footer(); ?>
3. Initial header.php
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset='<?php bloginfo( 'charset' ); ?>'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php endif; ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
4. Initial footer.php
<?php wp_footer(); ?>
</body>
</html>
5. Theme Setup - functions.php
<?php
function wp_massively_setup() {
global $content_width;
if ( ! isset( $content_width ) ) {
$content_width = 614;
}
add_theme_support( 'title-tag' );
add_theme_support(
'custom-logo', array(
'flex-width' => true,
'height' => 70,
)
);
load_theme_textdomain( 'wp-massively', get_template_directory() . '/languages' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
}
add_action( 'after_setup_theme', 'wp_massively_setup' );
6. Enqueue Scripts/Styles - functions.php
function wp_massively_scripts() {
wp_enqueue_style( 'wp_massively_merriweather', '//fonts.googleapis.com/css?family=Merriweather:
300,300i,400,400i,700,700i,900,900i');
wp_enqueue_style( 'wp_massively_open_sans', '//fonts.googleapis.com/css?family=Open+Sans:300,300i,
400,400i,600,600i,700,700i,800,800i');
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome/css/font-
awesome.min.css' );
wp_enqueue_style( 'wp_massively_style', get_stylesheet_uri() );
if ( is_singular() ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'wp_massively_main', get_template_directory_uri() . '/assets/js/modernizr.js' );
wp_enqueue_script( 'wp_massively_modernizr', get_template_directory_uri() . '/assets/js/main.js',
array( 'jquery' ), '', true );
}
add_action( 'wp_enqueue_scripts', 'wp_massively_scripts' );
7. Adding Logo to Header - header.php
<body <?php body_class(); ?>>
<header id="top">
<div class="row">
<div class="header-content twelve columns">
<h1 id="logo-text">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php bloginfo( 'name' ); ?>">
<?php
if ( get_theme_mod( 'custom_logo' ) ) {
$logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
echo '<img src="' . esc_url( $logo[0] ) . '">';
} else {
bloginfo( 'name' );
}
?>
</a>
</h1>
<p id="intro"><?php bloginfo( 'description' ); ?></p>
</div>
</div>
8.1 Adding a Menu - functions.php
register_nav_menus(
array(
'primary' => esc_html__( 'Primary Menu', 'wp- massively' ),
'social' => esc_html__( 'Social Menu', 'wp- massively' ),
)
);
}
add_action( 'after_setup_theme', 'wp_ massively_setup' );
8.2 Adding a Menu - header.php
<p id="intro"><?php bloginfo( 'description' ); ?></p>
</div>ย ย ย ย ย ย ย ย ย ย 
</div>
<nav id="nav-wrap">
<a class="mobile-btn" href="#nav-wrap" title="<?php echo esc_attr( 'Show Menu', 'wp-
massively' ); ?>">
<?php _e( 'Show Menu', 'wp-massively' ); ?>
</a>
<a class="mobile-btn" href="#" title="<?php echo esc_attr( 'Hide Menu', 'wp-massively' ); ?>">
<?php _e( 'Hide Menu', 'wp-massively' ); ?>
</a>
<div class="row"> ย ย ย ย ย ย ย 
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'menu' => esc_html__( 'Primary Menu', 'wp- massively' ),
'container' => 'ul',
'menu_class' => 'nav',
'menu_id' => 'nav',
) );
?>
</div>
</nav>
</header>
9.1 Adding Header Image/Background - functions.php
add_theme_support(
'custom-background', array(
'default-color' => '#FFFFFF',
)
);
add_theme_support(
'custom-header', array(
'default-image' => get_template_directory_uri() . '/assets/images/header.png',
'height' => 288,
'flex-height' => true,
'header-text' => false,
)
);
}
add_action( 'after_setup_theme', 'wp_ massively_setup' );
9.2 Add Background Image to header-content class - header.php
<div class="header-content twelve columns" style="background-image: url( '<?php header_image(); ?>' );">
10.1 Adding a Social Menu - footer.php
<footer>
<div class="row">
<div class="twelve columns">
<?php
wp_nav_menu( array(
'theme_location' => 'social',
'menu' => esc_html__( 'Social Menu', 'wp- massively' ),
'container' => 'ul',
'menu_class' => 'social-links',
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>',
) );
?>
</div>
<p class="copyright"><?php _e( '&copy; Copyright 2017 WP Massively. Design by <a title="Styleshout"
href="http://www.styleshout.com/">Styleshout</a>.', 'wp-massively' ); ?></p>
</div>
<div id="go-top"><a class="smoothscroll" title="Back to Top', 'wp-massively" href="#top"><i class="fa
fa-chevron-up"></i></a></div>
</footer>
<?php wp_footer(); ?>
</body>
</html>
10.2 Adding a Social Menu - style.css
.screen-reader-text {
ย ย ย ย clip: rect(1px, 1px, 1px, 1px);
ย ย ย ย position: absolute !important;
ย ย ย ย height: 1px;
ย ย ย ย width: 1px;
ย ย ย ย overflow: hidden;
}
footer .social-links a::before {
content: "f1e0";
font-family: 'FontAwesome';
font-size: 16px;
font-size: 1em;
display: block;
width: 20px;
height: 20px;
line-height: 20px;
}
footer .social-links a[href*="twitter.com"]::before {
content: 'f099';
}
11.1 Add Post Loop - index.php
<?php get_header(); ?>
<div id="content-wrap">
<div class="row">
<div id="main" class="eight columns">
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( 'content' );
endwhile;
the_posts_navigation();
else :
get_template_part( 'content', 'none' );
endif;
?>
</div>
</div>
</div>
<?php get_footer(); ?>
11.2 Add Post Loop Content - content.php
<article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?>>
<header class="entry-header">
<h2 class="entry-title">
<a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title();?></a>
</h2>
<div class="entry-meta">
<ul>
<li><?php echo esc_html( get_the_date() ); ?></li>
<span class="meta-sep">&bull;</span>
<?php $category = get_the_category(); ?>
<li><a href="<?php echo esc_url( get_category_link( $category[0]->term_id ) ); ?>" title="<?php echo
esc_attr( $category[0]->cat_name ); ?>" rel="category tag"><?php echo esc_html( $category[0]->cat_name ); ?></a></li>
<span class="meta-sep">&bull;</span>
<li><?php echo esc_html( get_the_author() ); ?></li>
</ul>
</div>
</header>
<div class="entry-content-media">
<div class="post-thumb">
<?php the_post_thumbnail(); ?>
</div>
</div>
<div class="entry-content">
<?php the_content(); ?>
</div>
</article>
11.3 Add 404 Template - content-none.php
<article class="entry">
<header class="entry-header">
<h2 class="entry-title">
<?php _e( 'Well, that's a shame.', 'wp-massively' ); ?>
</h2>
</header>
<div class="entry-content">
<p><?php _e( 'We weren't able to find what you were looking for.
Perhaps searching might help?', 'wp-massively' ); ?></p>
</div>
<?php get_search_form(); ?>
</article>
12.1 Registering a Widget Area - functions.php
function wp_massively_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'wp-massively' ),
'id' => 'sidebar-main',
'description' => esc_html__( 'Sidebar widget area.', 'wp-massively' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
}
add_action( 'widgets_init', 'wp_ massively_widgets_init' );
12.2 Displaying a Sidebar - sidebar.php
<?php
if ( ! is_active_sidebar( 'sidebar-main' ) ) {
return;
}
?>
<div id="sidebar" class="four columns">
<?php dynamic_sidebar( 'sidebar-main' ); ?>
</div>
12.3 Call Sidebar - index.php
<?php get_header(); ?>
<div id="content-wrap">
<div class="row">
<div id="main" class="eight columns">
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( 'content' );
endwhile;
the_posts_navigation();
else :
get_template_part( 'content', 'none' );
endif;
?>
</div>
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>
13.1 Make Single Post - single.php
<?php get_header(); ?>
<div id="content-wrap">
<div class="row">
<div id="main" class="eight columns">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'content', 'single' );
the_post_navigation(
array(
'prev_text' => _x( '<strong>Previous Article</strong><span class="post-title">%title</span>',
'previous post', 'wp-massively' ),
'next_text' => _x( '<strong>Next Article</strong><span class="post-title">%title</span>', 'next
post', 'wp-massively' ),
)
);
if ( comments_open() || get_comments_number() ) :
echo '<div id="comments">';
comments_template();
echo '</div>';
endif;
endwhile;
?>
</div>
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>
13.2 Make Post Content - content-single.php
<article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?>>
<header class="entry-header">
<h2 class="entry-title">
<?php the_title();?>
</h2>
<div class="entry-meta">
<ul>
<li><?php echo esc_html( get_the_date() ); ?></li>
<span class="meta-sep">&bull;</span>
<?php $category = get_the_category(); ?>
<li><a href="<?php echo esc_url( get_category_link( $category[0]->term_id ) ); ?>" title="<?php echo
esc_attr( $category[0]->cat_name ); ?>" rel="category tag"><?php echo esc_html( $category[0]->cat_name ); ?></a></li>
<span class="meta-sep">&bull;</span>
<li><?php echo esc_html( get_the_author() ); ?></li>
</ul>
</div>
</header>
<div class="entry-content-media">
<div class="post-thumb">
<?php the_post_thumbnail(); ?>
</div>
</div>
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages(); ?>
</div>
<?php the_tags( __( '<div class="tags">Tagged in: ', 'wp-massively' ), ', ', ' </div>'); ?>
</article>
13.3.1 Comment Template - comments.php
<?php
if ( post_password_required() ) {
return;
}
?>
<div id="comments" class="comments-area">
<?php
if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php
$comments_number = get_comments_number();
if ( '1' === $comments_number ) {
printf( _x( 'One Reply to &ldquo;%s&rdquo;', 'comments title', 'wp-massively' ), get_the_title() );
} else {
printf(
_nx(
'%1$s Reply to &ldquo;%2$s&rdquo;',
'%1$s Replies to &ldquo;%2$s&rdquo;',
$comments_number,
'comments title',
'wp-massively'
),
number_format_i18n( $comments_number ),
get_the_title()
);
}
?>
</h2>
13.3.2 Comment Template - comments.php
<ol class="commentlist">
<?php
wp_list_comments( array(
'avatar_size' => 32,
'style' => 'li',
'short_ping' => true,
'reply_text' => __( 'Reply', 'wp-massively' ),
) );
?>
</ol>
<?php the_comments_pagination( array(
'prev_text' => '<span class="screen-reader-text">' . __( 'Previous', 'wp-massively' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next', 'wp-massively' ) . '</span>',
) );
endif;
if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p class="no-comments"><?php _e( 'Comments are closed.', 'wp-massively' ); ?></p>
<?php
endif;
comment_form();
?>
</div>
14.1 Make Page - page.php
<?php get_header(); ?>
<div id="content-wrap">
<div class="row">
<div id="main" class="twelve columns">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'content', 'page' );
if ( comments_open() || get_comments_number() ) :
echo '<div id="comments">';
comments_template();
echo '</div>';
endif;
endwhile;
?>
</div>
</div>
</div>
<?php get_footer(); ?>
14.2 Make Page Content - content-page.php
<article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?>>
<header class="entry-header">
<h1 class="entry-title">
<?php the_title();?>
</h1>
</header>
<div class="entry-content-media">
<div class="post-thumb">
<?php the_post_thumbnail(); ?>
</div>
</div>
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages(); ?>
</div>
</article>
Where to go from here?
โžค WordPress Theme Development Handbook: https://developer.wordpress.org/
themes/getting-started/
โžค WordPress Theme Review Team Guidelines: https://make.wordpress.org/themes/
handbook/review/required/
โžค If you have any questions then standing right in front of you.
โžค Tackling at home and got stuck somewhere? Have any question? Just open an issue
at: https://github.com/HardeepAsrani/wp-massively/issues
Iโ€™m Hardeep Asrani
@HardeepAsrani
hardeepasrani.com
Pirate at ThemeIsle.com

More Related Content

What's hot

Wordpress Beyond Websites
Wordpress Beyond WebsitesWordpress Beyond Websites
Wordpress Beyond WebsitesScott Saunders
ย 
Build a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ TelerikBuild a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ TelerikMario Peshev
ย 
WordPress Theme Development: Part 2
WordPress Theme Development: Part 2WordPress Theme Development: Part 2
WordPress Theme Development: Part 2Josh Lee
ย 
Seven deadly theming sins
Seven deadly theming sinsSeven deadly theming sins
Seven deadly theming sinsGeorge Stephanis
ย 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme developmentTammy Hart
ย 
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...cehwitham
ย 
WordPress Theme Structure
WordPress Theme StructureWordPress Theme Structure
WordPress Theme Structurekeithdevon
ย 
Cakephp's Cache
Cakephp's CacheCakephp's Cache
Cakephp's Cachevl
ย 
20190118_NetadashiMeetup#8_React2019
20190118_NetadashiMeetup#8_React201920190118_NetadashiMeetup#8_React2019
20190118_NetadashiMeetup#8_React2019Makoto Mori
ย 
Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015buildstudio
ย 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin developmentMostafa Soufi
ย 
Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress WayMatt Wiebe
ย 
Getting to The Loop - London Wordpress Meetup July 28th
Getting to The Loop - London Wordpress Meetup  July 28thGetting to The Loop - London Wordpress Meetup  July 28th
Getting to The Loop - London Wordpress Meetup July 28thChris Adams
ย 
WordPress basic fundamental of plugin development and creating shortcode
WordPress basic fundamental of plugin development and creating shortcodeWordPress basic fundamental of plugin development and creating shortcode
WordPress basic fundamental of plugin development and creating shortcodeRakesh Kushwaha
ย 
WordCamp Praga 2015
WordCamp Praga 2015WordCamp Praga 2015
WordCamp Praga 2015Tomasz Dziuda
ย 
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
ย 
Assetic (Zendcon)
Assetic (Zendcon)Assetic (Zendcon)
Assetic (Zendcon)Kris Wallsmith
ย 
Css web gallery
Css web galleryCss web gallery
Css web galleryDaniel Downs
ย 

What's hot (20)

Wordpress Beyond Websites
Wordpress Beyond WebsitesWordpress Beyond Websites
Wordpress Beyond Websites
ย 
Build a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ TelerikBuild a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ Telerik
ย 
WordPress Theme Development: Part 2
WordPress Theme Development: Part 2WordPress Theme Development: Part 2
WordPress Theme Development: Part 2
ย 
Seven deadly theming sins
Seven deadly theming sinsSeven deadly theming sins
Seven deadly theming sins
ย 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
ย 
Articulo java web
Articulo java webArticulo java web
Articulo java web
ย 
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
ย 
WordPress Theme Structure
WordPress Theme StructureWordPress Theme Structure
WordPress Theme Structure
ย 
Cakephp's Cache
Cakephp's CacheCakephp's Cache
Cakephp's Cache
ย 
20190118_NetadashiMeetup#8_React2019
20190118_NetadashiMeetup#8_React201920190118_NetadashiMeetup#8_React2019
20190118_NetadashiMeetup#8_React2019
ย 
Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015Make More Money With Advanced Custom Fields - WordCampYYC 2015
Make More Money With Advanced Custom Fields - WordCampYYC 2015
ย 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin development
ย 
Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress Way
ย 
Getting to The Loop - London Wordpress Meetup July 28th
Getting to The Loop - London Wordpress Meetup  July 28thGetting to The Loop - London Wordpress Meetup  July 28th
Getting to The Loop - London Wordpress Meetup July 28th
ย 
20110820 header new style
20110820 header new style20110820 header new style
20110820 header new style
ย 
WordPress basic fundamental of plugin development and creating shortcode
WordPress basic fundamental of plugin development and creating shortcodeWordPress basic fundamental of plugin development and creating shortcode
WordPress basic fundamental of plugin development and creating shortcode
ย 
WordCamp Praga 2015
WordCamp Praga 2015WordCamp Praga 2015
WordCamp Praga 2015
ย 
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
ย 
Assetic (Zendcon)
Assetic (Zendcon)Assetic (Zendcon)
Assetic (Zendcon)
ย 
Css web gallery
Css web galleryCss web gallery
Css web gallery
ย 

Similar to How to make a WordPress theme

The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
ย 
WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4David Bisset
ย 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPressNile Flores
ย 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress WebsitesKyle Cearley
ย 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentBrad Williams
ย 
Word Camp Fukuoka2010
Word Camp Fukuoka2010Word Camp Fukuoka2010
Word Camp Fukuoka2010YUKI YAMAGUCHI
ย 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress PluginBrad Williams
ย 
Mobile themes, QR codes, and shortURLs
Mobile themes, QR codes, and shortURLsMobile themes, QR codes, and shortURLs
Mobile themes, QR codes, and shortURLsHarvard Web Working Group
ย 
Word press templates
Word press templatesWord press templates
Word press templatesDan Phiffer
ย 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practicesmarkparolisi
ย 
Creating Themes
Creating ThemesCreating Themes
Creating ThemesDaisyOlsen
ย 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3David Bisset
ย 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) ThemingPINGV
ย 
Easy Guide to WordPress Theme Integration
Easy Guide to WordPress Theme IntegrationEasy Guide to WordPress Theme Integration
Easy Guide to WordPress Theme IntegrationSankhala Info Solutions
ย 
Building themesfromscratchwithframeworks
Building themesfromscratchwithframeworksBuilding themesfromscratchwithframeworks
Building themesfromscratchwithframeworksDavid Brattoli
ย 
Now That's What I Call WordPress Security 2010
Now That's What I Call WordPress Security 2010Now That's What I Call WordPress Security 2010
Now That's What I Call WordPress Security 2010Brad Williams
ย 
WordPress Security Updated - NYC Meetup 2009
WordPress Security Updated - NYC Meetup 2009WordPress Security Updated - NYC Meetup 2009
WordPress Security Updated - NYC Meetup 2009Brad Williams
ย 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Themecertainstrings
ย 

Similar to How to make a WordPress theme (20)

The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
ย 
WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4
ย 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPress
ย 
Theming 101
Theming 101Theming 101
Theming 101
ย 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
ย 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
ย 
Word Camp Fukuoka2010
Word Camp Fukuoka2010Word Camp Fukuoka2010
Word Camp Fukuoka2010
ย 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
ย 
Mobile themes, QR codes, and shortURLs
Mobile themes, QR codes, and shortURLsMobile themes, QR codes, and shortURLs
Mobile themes, QR codes, and shortURLs
ย 
Word press templates
Word press templatesWord press templates
Word press templates
ย 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
ย 
Creating Themes
Creating ThemesCreating Themes
Creating Themes
ย 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
ย 
Grok Drupal (7) Theming
Grok Drupal (7) ThemingGrok Drupal (7) Theming
Grok Drupal (7) Theming
ย 
Easy Guide to WordPress Theme Integration
Easy Guide to WordPress Theme IntegrationEasy Guide to WordPress Theme Integration
Easy Guide to WordPress Theme Integration
ย 
Building themesfromscratchwithframeworks
Building themesfromscratchwithframeworksBuilding themesfromscratchwithframeworks
Building themesfromscratchwithframeworks
ย 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
ย 
Now That's What I Call WordPress Security 2010
Now That's What I Call WordPress Security 2010Now That's What I Call WordPress Security 2010
Now That's What I Call WordPress Security 2010
ย 
WordPress Security Updated - NYC Meetup 2009
WordPress Security Updated - NYC Meetup 2009WordPress Security Updated - NYC Meetup 2009
WordPress Security Updated - NYC Meetup 2009
ย 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Theme
ย 

Recently uploaded

Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
ย 
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLLucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLimonikaupta
ย 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
ย 
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
ย 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
ย 
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
ย 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
ย 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
ย 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubaikojalkojal131
ย 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...SUHANI PANDEY
ย 
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Datingkojalkojal131
ย 
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort Service
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort ServiceEnjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort Service
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort ServiceDelhi Call girls
ย 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceEscorts Call Girls
ย 
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort ServiceBusty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort ServiceDelhi Call girls
ย 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...SUHANI PANDEY
ย 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls DubaiEscorts Call Girls
ย 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...SUHANI PANDEY
ย 
Call Now โ˜Ž 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now โ˜Ž 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.soniya singh
ย 

Recently uploaded (20)

Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
ย 
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLLucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
ย 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
ย 
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
ย 
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
ย 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
ย 
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
ย 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
ย 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
ย 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
ย 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
ย 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
ย 
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
ย 
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort Service
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort ServiceEnjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort Service
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort Service
ย 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
ย 
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort ServiceBusty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
ย 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
ย 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
ย 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
ย 
Call Now โ˜Ž 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now โ˜Ž 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
ย 

How to make a WordPress theme

  • 1. How to Make a WordPress Theme Hardeep Asrani
  • 2. Things we need to startโ€ฆ โžค WordPress on your system. โžค A good IDE. โžค Starter ๏ฌles from Github: โžค A basic/good knowledge of HTML, CSS and PHP.
  • 3. Whatโ€™s a theme in WordPress?
  • 6. Functions of main files โžค style.css โžค index.php โžค functions.php โžค header.php โžค footer.php โžค single.php โžค page.php โžค comments.php
  • 8. Starter Content โžค HTML Design: https://www.styleshout.com/free-templates/keep-it-simple/ โžค Workshop Content: https://github.com/HardeepAsrani/wp-massively โžค Workshop Content has two folders, start and ๏ฌnished. โžค We will use /start/ folder to make a theme. โžค If you want to see the completed theme, you can see the /๏ฌnished/ theme.
  • 9. 1. Theme Info - style.css /* Theme Name: WP Massively Theme URI: https://github.com/HardeepAsrani/wp-massively/ Author: Hardeep Asrani Author URI: http://www.hardeepasrani.com Description: A learning project for WordCamp Singapore. Version: 1.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: wp-massively Tags: blog, custom-logo, one-column, two-columns, custom-backgroundโ€ฆ */ /* Rest of your CSS goes here. */
  • 10. 2. Initial index.php <?php get_header(); ?> <?php // Rest of your content goes here. ?> <?php get_footer(); ?>
  • 11. 3. Initial header.php <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset='<?php bloginfo( 'charset' ); ?>'> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="profile" href="http://gmpg.org/xfn/11"> <?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> <?php endif; ?> <?php wp_head(); ?> </head> <body <?php body_class(); ?>>
  • 12. 4. Initial footer.php <?php wp_footer(); ?> </body> </html>
  • 13. 5. Theme Setup - functions.php <?php function wp_massively_setup() { global $content_width; if ( ! isset( $content_width ) ) { $content_width = 614; } add_theme_support( 'title-tag' ); add_theme_support( 'custom-logo', array( 'flex-width' => true, 'height' => 70, ) ); load_theme_textdomain( 'wp-massively', get_template_directory() . '/languages' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'post-thumbnails' ); } add_action( 'after_setup_theme', 'wp_massively_setup' );
  • 14. 6. Enqueue Scripts/Styles - functions.php function wp_massively_scripts() { wp_enqueue_style( 'wp_massively_merriweather', '//fonts.googleapis.com/css?family=Merriweather: 300,300i,400,400i,700,700i,900,900i'); wp_enqueue_style( 'wp_massively_open_sans', '//fonts.googleapis.com/css?family=Open+Sans:300,300i, 400,400i,600,600i,700,700i,800,800i'); wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome/css/font- awesome.min.css' ); wp_enqueue_style( 'wp_massively_style', get_stylesheet_uri() ); if ( is_singular() ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'wp_massively_main', get_template_directory_uri() . '/assets/js/modernizr.js' ); wp_enqueue_script( 'wp_massively_modernizr', get_template_directory_uri() . '/assets/js/main.js', array( 'jquery' ), '', true ); } add_action( 'wp_enqueue_scripts', 'wp_massively_scripts' );
  • 15.
  • 16. 7. Adding Logo to Header - header.php <body <?php body_class(); ?>> <header id="top"> <div class="row"> <div class="header-content twelve columns"> <h1 id="logo-text"> <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php bloginfo( 'name' ); ?>"> <?php if ( get_theme_mod( 'custom_logo' ) ) { $logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ); echo '<img src="' . esc_url( $logo[0] ) . '">'; } else { bloginfo( 'name' ); } ?> </a> </h1> <p id="intro"><?php bloginfo( 'description' ); ?></p> </div> </div>
  • 17.
  • 18.
  • 19. 8.1 Adding a Menu - functions.php register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'wp- massively' ), 'social' => esc_html__( 'Social Menu', 'wp- massively' ), ) ); } add_action( 'after_setup_theme', 'wp_ massively_setup' );
  • 20. 8.2 Adding a Menu - header.php <p id="intro"><?php bloginfo( 'description' ); ?></p> </div>ย ย ย ย ย ย ย ย ย ย  </div> <nav id="nav-wrap"> <a class="mobile-btn" href="#nav-wrap" title="<?php echo esc_attr( 'Show Menu', 'wp- massively' ); ?>"> <?php _e( 'Show Menu', 'wp-massively' ); ?> </a> <a class="mobile-btn" href="#" title="<?php echo esc_attr( 'Hide Menu', 'wp-massively' ); ?>"> <?php _e( 'Hide Menu', 'wp-massively' ); ?> </a> <div class="row"> ย ย ย ย ย ย ย  <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu' => esc_html__( 'Primary Menu', 'wp- massively' ), 'container' => 'ul', 'menu_class' => 'nav', 'menu_id' => 'nav', ) ); ?> </div> </nav> </header>
  • 21.
  • 22. 9.1 Adding Header Image/Background - functions.php add_theme_support( 'custom-background', array( 'default-color' => '#FFFFFF', ) ); add_theme_support( 'custom-header', array( 'default-image' => get_template_directory_uri() . '/assets/images/header.png', 'height' => 288, 'flex-height' => true, 'header-text' => false, ) ); } add_action( 'after_setup_theme', 'wp_ massively_setup' );
  • 23. 9.2 Add Background Image to header-content class - header.php <div class="header-content twelve columns" style="background-image: url( '<?php header_image(); ?>' );">
  • 24.
  • 25. 10.1 Adding a Social Menu - footer.php <footer> <div class="row"> <div class="twelve columns"> <?php wp_nav_menu( array( 'theme_location' => 'social', 'menu' => esc_html__( 'Social Menu', 'wp- massively' ), 'container' => 'ul', 'menu_class' => 'social-links', 'link_before' => '<span class="screen-reader-text">', 'link_after' => '</span>', ) ); ?> </div> <p class="copyright"><?php _e( '&copy; Copyright 2017 WP Massively. Design by <a title="Styleshout" href="http://www.styleshout.com/">Styleshout</a>.', 'wp-massively' ); ?></p> </div> <div id="go-top"><a class="smoothscroll" title="Back to Top', 'wp-massively" href="#top"><i class="fa fa-chevron-up"></i></a></div> </footer> <?php wp_footer(); ?> </body> </html>
  • 26. 10.2 Adding a Social Menu - style.css .screen-reader-text { ย ย ย ย clip: rect(1px, 1px, 1px, 1px); ย ย ย ย position: absolute !important; ย ย ย ย height: 1px; ย ย ย ย width: 1px; ย ย ย ย overflow: hidden; } footer .social-links a::before { content: "f1e0"; font-family: 'FontAwesome'; font-size: 16px; font-size: 1em; display: block; width: 20px; height: 20px; line-height: 20px; } footer .social-links a[href*="twitter.com"]::before { content: 'f099'; }
  • 27.
  • 28. 11.1 Add Post Loop - index.php <?php get_header(); ?> <div id="content-wrap"> <div class="row"> <div id="main" class="eight columns"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); get_template_part( 'content' ); endwhile; the_posts_navigation(); else : get_template_part( 'content', 'none' ); endif; ?> </div> </div> </div> <?php get_footer(); ?>
  • 29. 11.2 Add Post Loop Content - content.php <article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?>> <header class="entry-header"> <h2 class="entry-title"> <a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title();?></a> </h2> <div class="entry-meta"> <ul> <li><?php echo esc_html( get_the_date() ); ?></li> <span class="meta-sep">&bull;</span> <?php $category = get_the_category(); ?> <li><a href="<?php echo esc_url( get_category_link( $category[0]->term_id ) ); ?>" title="<?php echo esc_attr( $category[0]->cat_name ); ?>" rel="category tag"><?php echo esc_html( $category[0]->cat_name ); ?></a></li> <span class="meta-sep">&bull;</span> <li><?php echo esc_html( get_the_author() ); ?></li> </ul> </div> </header> <div class="entry-content-media"> <div class="post-thumb"> <?php the_post_thumbnail(); ?> </div> </div> <div class="entry-content"> <?php the_content(); ?> </div> </article>
  • 30.
  • 31. 11.3 Add 404 Template - content-none.php <article class="entry"> <header class="entry-header"> <h2 class="entry-title"> <?php _e( 'Well, that's a shame.', 'wp-massively' ); ?> </h2> </header> <div class="entry-content"> <p><?php _e( 'We weren't able to find what you were looking for. Perhaps searching might help?', 'wp-massively' ); ?></p> </div> <?php get_search_form(); ?> </article>
  • 32.
  • 33. 12.1 Registering a Widget Area - functions.php function wp_massively_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'wp-massively' ), 'id' => 'sidebar-main', 'description' => esc_html__( 'Sidebar widget area.', 'wp-massively' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } add_action( 'widgets_init', 'wp_ massively_widgets_init' );
  • 34. 12.2 Displaying a Sidebar - sidebar.php <?php if ( ! is_active_sidebar( 'sidebar-main' ) ) { return; } ?> <div id="sidebar" class="four columns"> <?php dynamic_sidebar( 'sidebar-main' ); ?> </div>
  • 35. 12.3 Call Sidebar - index.php <?php get_header(); ?> <div id="content-wrap"> <div class="row"> <div id="main" class="eight columns"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); get_template_part( 'content' ); endwhile; the_posts_navigation(); else : get_template_part( 'content', 'none' ); endif; ?> </div> <?php get_sidebar(); ?> </div> </div> <?php get_footer(); ?>
  • 36.
  • 37. 13.1 Make Single Post - single.php <?php get_header(); ?> <div id="content-wrap"> <div class="row"> <div id="main" class="eight columns"> <?php while ( have_posts() ) : the_post(); get_template_part( 'content', 'single' ); the_post_navigation( array( 'prev_text' => _x( '<strong>Previous Article</strong><span class="post-title">%title</span>', 'previous post', 'wp-massively' ), 'next_text' => _x( '<strong>Next Article</strong><span class="post-title">%title</span>', 'next post', 'wp-massively' ), ) ); if ( comments_open() || get_comments_number() ) : echo '<div id="comments">'; comments_template(); echo '</div>'; endif; endwhile; ?> </div> <?php get_sidebar(); ?> </div> </div> <?php get_footer(); ?>
  • 38. 13.2 Make Post Content - content-single.php <article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?>> <header class="entry-header"> <h2 class="entry-title"> <?php the_title();?> </h2> <div class="entry-meta"> <ul> <li><?php echo esc_html( get_the_date() ); ?></li> <span class="meta-sep">&bull;</span> <?php $category = get_the_category(); ?> <li><a href="<?php echo esc_url( get_category_link( $category[0]->term_id ) ); ?>" title="<?php echo esc_attr( $category[0]->cat_name ); ?>" rel="category tag"><?php echo esc_html( $category[0]->cat_name ); ?></a></li> <span class="meta-sep">&bull;</span> <li><?php echo esc_html( get_the_author() ); ?></li> </ul> </div> </header> <div class="entry-content-media"> <div class="post-thumb"> <?php the_post_thumbnail(); ?> </div> </div> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages(); ?> </div> <?php the_tags( __( '<div class="tags">Tagged in: ', 'wp-massively' ), ', ', ' </div>'); ?> </article>
  • 39. 13.3.1 Comment Template - comments.php <?php if ( post_password_required() ) { return; } ?> <div id="comments" class="comments-area"> <?php if ( have_comments() ) : ?> <h2 class="comments-title"> <?php $comments_number = get_comments_number(); if ( '1' === $comments_number ) { printf( _x( 'One Reply to &ldquo;%s&rdquo;', 'comments title', 'wp-massively' ), get_the_title() ); } else { printf( _nx( '%1$s Reply to &ldquo;%2$s&rdquo;', '%1$s Replies to &ldquo;%2$s&rdquo;', $comments_number, 'comments title', 'wp-massively' ), number_format_i18n( $comments_number ), get_the_title() ); } ?> </h2>
  • 40. 13.3.2 Comment Template - comments.php <ol class="commentlist"> <?php wp_list_comments( array( 'avatar_size' => 32, 'style' => 'li', 'short_ping' => true, 'reply_text' => __( 'Reply', 'wp-massively' ), ) ); ?> </ol> <?php the_comments_pagination( array( 'prev_text' => '<span class="screen-reader-text">' . __( 'Previous', 'wp-massively' ) . '</span>', 'next_text' => '<span class="screen-reader-text">' . __( 'Next', 'wp-massively' ) . '</span>', ) ); endif; if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?> <p class="no-comments"><?php _e( 'Comments are closed.', 'wp-massively' ); ?></p> <?php endif; comment_form(); ?> </div>
  • 41.
  • 42. 14.1 Make Page - page.php <?php get_header(); ?> <div id="content-wrap"> <div class="row"> <div id="main" class="twelve columns"> <?php while ( have_posts() ) : the_post(); get_template_part( 'content', 'page' ); if ( comments_open() || get_comments_number() ) : echo '<div id="comments">'; comments_template(); echo '</div>'; endif; endwhile; ?> </div> </div> </div> <?php get_footer(); ?>
  • 43. 14.2 Make Page Content - content-page.php <article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?>> <header class="entry-header"> <h1 class="entry-title"> <?php the_title();?> </h1> </header> <div class="entry-content-media"> <div class="post-thumb"> <?php the_post_thumbnail(); ?> </div> </div> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages(); ?> </div> </article>
  • 44.
  • 45. Where to go from here? โžค WordPress Theme Development Handbook: https://developer.wordpress.org/ themes/getting-started/ โžค WordPress Theme Review Team Guidelines: https://make.wordpress.org/themes/ handbook/review/required/ โžค If you have any questions then standing right in front of you. โžค Tackling at home and got stuck somewhere? Have any question? Just open an issue at: https://github.com/HardeepAsrani/wp-massively/issues