Create new theme in wordpress

At the very minimum, a WordPress Theme consists of two files:

  1. style.css
  2. index.php

style.css contains information about theme.

/*
Theme Name: My Theme
Theme URI: https://santoshyadavcse.wordpress.com/
Author: Santosh Yadav
Author URI: https://santoshyadavcse.wordpress.com/about-santosh/
Description: This is simple theme used for theme creation demo.
Version: 1.0
License: GNU General Public License
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
/* add your css below */

index.php file is main file loaded for your theme.

<?php
/* Write your code here */
?>

For more detail on them development you may refer to this page https://codex.wordpress.org/Theme_Development

Custom page template in wordpress

WordPress come with default template  for any of the post, page ,category etc.For example we have template category.php for category and page.php for pages.

Below is method two change default template

1.How to change page template.

Method 1

Create custom page template. For eg : use below code to create page template.Create a php file in your them and put below code to create new template

<?php
/*
Template Name: Full Width Page with No Sidebar
*/
get_header(); ?>
    <div id="primary" class="site-content">
        <div id="content" role="main">
            <?php while ( have_posts() ) : the_post(); ?>
                <?php get_template_part( 'content', 'page' ); ?>
                <?php comments_template( '', true ); ?>
            <?php endwhile; // end of the loop. ?>
        </div><!-- #content -->
    </div><!-- #primary -->
<?php get_footer(); ?>

Edit page and select page template Full Width Page with No Sidebar From right template list.

Method 2 :
Create new template with page id – page-{$id}.php

Method 3:
Create page template with slug name.
If your page have slug name about then create page template with name page-about.php

Page template hirarchy.
Below is template order in which template are called

Custom Template — If the Page has a custom Template assigned, WordPress looks for that file and, if found, uses it.
page-{slug}.php — Else WordPress looks for and, if found, uses a specialized template named with the Page’s slug.
page-{id}.php — Else WordPress looks for and, if found, uses a specialized template named with the Page’s ID.
page.php — Else WordPress looks for and, if found, uses the Theme’s default page template.
index.php — Else WordPress uses a the Theme’s index file.

 

2.How to change category template.

Method 1
category-{$id}.php

Method 2
category-{slug}.php

Category template hirarchy
category-{slug}.php — Else WordPress looks for and, if found, uses a specialized template named with the Page’s slug.
category-{id}.php — Else WordPress looks for and, if found, uses a specialized template named with the category‘s ID.
category.php — Else WordPress looks for and, if found, uses the Theme’s default category template.
index.php — Else WordPress uses a the Theme’s index file.

 

 

If any query please drop below your below your comments.

Cheers

WordPress most popular plugin

Plugin allow you to extend core of wordpress. Most popular used plugin are-

Show Custom form on website

Contact Form 7 : https://wordpress.org/plugins/contact-form-7/

For SEO

WordPress SEO By Youst : https://wordpress.org/plugins/wordpress-seo/

For Performance

WP Super  Cache : https://wordpress.org/plugins/wp-super-cache/

For E-commerce

Woo Commerce : https://wordpress.org/plugins/woocommerce/

For Easy Customization of page content

Advanced Custom Fields (ACF):https://wordpress.org/plugins/advanced-custom-fields/

Security 

Captcha : https://wordpress.org/plugins/captcha/

I will keep posting on important wordpress plugins. keep looking.

WordPress and it’s features.

WordPress is not limited to blogging but you can build everything from simple websites, to blogs, to complex portals and enterprise websites, and even applications, are built with WordPress.

The most poular features are as

  • Open Source.
  • Full Standard Complaince
  • Easy theming.
  • Compatible with devices
  • Extendable & Flexible
  • Community Support

For developer it offers variety of facilities.

  • Plugin : To Extend core files
  • Custom content type
  • Theming
  • Contributing
  • Sidebar and widgets to customize layout