Wp Temlate

How to change the name of default template for pages in wordpress

When we are adding a wordpress page, we can select the page attributes from the right side of the screen.
Page attribute includes template selection as we know that we can select the template of our choice from the dropdown.template

We can create our own template for any specific page. In the same manner we are able to create a generalized template for multiple pages. To create a template we just need to write the template name in commented format. Our custom templates will appear in wordpress page edit screen in template dropdown under attributes section. We can choose template of our choice for particular page from the dropdown.

Now you can see there is a “Default Template” always appears in the dropdown and it comes selected for every new page by default. It is a wordpress default template for all pages and we can modify its appearance and features from the page.php file of our current theme. When we are creating our website and we want the name “Default Template” should matches to our website name like “Mywebsite Template” or anything else we want then we can change it by using a predefined wordpress hook that is “default_page_template_title”.

To change this for your website, just copy the below mentioned code and paste it in functions.php file of your current theme :

function wptricks24_change_template_name( $label, $context ) {
  return __( 'Wptricks24 Default Template', 'textdomain' ); // new template name will be "Wptricks24 Default Template"
add_filter( 'default_page_template_title', 'wptricks24_change_template_name');

Just look at the above code, “Wptricks24 Default Template” is the name for my website default template. You can modify it as per your website name or anything which you want to show for a default template in wordpress pages in admin area.

In the above code we are using a default filter hook of wordpress that is “default_page_template_title”. This hook was first introduced in wordpress version 4.1 so you can use this code for all wordress version after that.

This code will not affect any other functionality of your website, it will only change the name of default template silently

Mostakim Hossen

I am Mostakim Hossain, a Web designer and developer, 23 years of age. I have been working as a freelance (upwork) for almost 2 years now and I will be glad in helping you create your next awesome project.

I have created lots of public and private websites(some shown below) and always looking for more work to learn from. I am using PHP as my primary programming language. You can see my skill set beside this text.

I am a person who is willing to learn and adapts quickly. I am keen to design and security. I believe in the core principles of Open Source and support it. I have a minimalist approach to design and usability. Simplicity is beauty they say.
Masters of Accountancy : Asian University of Bangladesh
I’m here to answer any questions you might have about our products and services. Feel free to contact me using any of the following methods:

Email : support@smarterdevs.com

Leave a Reply

Your email address will not be published. Required fields are marked *


Coupon : happynewyear

60% OFF

Stay updated with all latest updates,upcoming plugins & much more.
WordPress Themes