Create Custom Theme in WordPress

1. Give a Complete Path of images and files

<?php echo get_template_directory_uri();?>/

2. Call Header & Footer Files

<?php get_header(); ?>
<?php get_footer(); ?>

3. Reg. Menus for Website & WordPress Dashboard

i. To Reg. WordPress Menu
To register a navigation menu in WordPress these two functions should be used:

Add below code in function file to display menu option in WordPress Dashboard.

array(‘primary-menu’=>’Header Meanu’)

ii. To Reg. Website Menu
For the navigation menu, you have to do two tasks, and you will have to bring it to work on both sides, to bring it on the admin part, and to show it on the website.

Add the below code in the header file to display menus on the website

array(‘theme_location’=>’primary-menu’,’menu_class’=>’nav navbar-nav’)

4. Display Pages Title and Content

Note: By Default index.php loads on the website domain. But when we click on any Nav Link it loads the page.php file.

    <?php the_title(); ?>   
this function is used to display the Page Title of All Pages. Add this function in page.php to display the title.
<?php the_content(); ?>   
this function is used to display the Page Data of All Pages. Add this function in page.php to display the Data.

4. How to Display Feature Image

Add this function in the functions.php file that will enable the featured image option in the WordPress dashboard.

Add this function in the page.php file that will display the featured image option on the website. You can get a thumbnail image with a tag and also get an idea about the image path. You can change the parameter in a thumbnail image and set the resolution as per the requirements.
You can edit the image resolution and get the image path with this function.

Dynamic Logo for Website

You can Add the Header Logo option in Appearance by this function.


Add Above function in functions.php file.

Add the below function to header.php to display the logo on your website header & Link with Home Page.

 <a class=”navbar-brand” href=”<?php echo site_url();?> “>
<?php $logo = get_header_image(); ?>
  <img src=”<?php echo $logo; ?>” alt=”logo” /></a>

Create a New Template

Create a new file named any-name.php and write below code
    //Template Name:Contact us
We know that WordPress by default displays a page.php template if you want to display a new design on any page Use the above script and write code for the new design. you can make a custom template design for any page of your website. You can use this template for any page design.

Leave a Comment

Share via
Copy link