2. What is a WordPress theme?
A group of templates and a stylesheet that displays content
entered into the database via the WordPress admin.
At a minimum, you need:
index.php
style.css
3. Let’s Start
[ Get Free Responsive Template ]
Download the brownie template from:
http://www.html5xcss3.com/2012/06/html5-template-
responsive-brownie.html
Copy and paste the HTML design file to WordPress theme
directory.
[ wp-content/themes/brownie ]
Rename the index.html to index.php
Create a style.css file in brownie.
[ wp-content/themes/brownie/style.css ]
4. style.css
[ Template Settings ]
/*
Theme Name: Brownie.
Theme URI: http://merobox.com/
Description: This is my first WordPress template.
Author: Chandra Prakash Thapa.
Author URI: http://cpthapa.com.np/
Version: 1.0
Tags: brown, two-columns, custom-background,
License:
License URI:
General comments (optional).
*/
10. A Basic Theme Requirement
404.php - Custom “not found” page
footer.php - The template called with get_footer()
functions.php - A place to create custom functions, register sidebars, and other settings
header.php - The template called with get_header()
index.php - The default template
home.php - The basic home template
page.php - Overall template for pages
search.php - Search results template
searchform.php - The template called with get_search_form()
sidebar.php - The template called with get_sidebar()
single.php - Overall template for single posts
style.css - The main stylesheet
13. Header.php
// Add wp_head() function before end of </head> tag.
<?php wp_head (); ?>
</head>
<body>
<header class="header_bg clearfix">
14. Header.php
// Add title to your website
<title>
<?php bloginfo('name'); // Title of the website ?>
<?php wp_title(); // Title of the single page or post ?>
</title>
18. functions.php
File is place inside theme folder.
wp-content/themes/yourtheme/functions.php
Changes default behavior of WordPress.
Behaves like WordPress Plugin.
Use it to call PHP or built-in WordPress functions.
Use to define your own functions.
Register menu, sidebar and widgets.
19. Registering Menu
// registering header and footer menu in functions.php file
function merobox_addmenus() {
register_nav_menus(
array(
'header_nav' => 'Header Menu',
'footer_nav' => 'Footer Menu'
)
);
}
add_action('init', 'merobox_addmenus');
46. index.phpsingle.php
Copy all code from single.php to index.php
Just remove the_content( ) with the_excerpt( )
And add read more link using the_permalink( );
Index.php
[ default template ]