Every new hosting plan ordered during APR2019 can request free DNSSEC setup ($39 value). Use coupon APR2019 for free DNSSEC ($39 value).
Dominate local SEO with a regional SlickStack cloud server for just $39/month! Order Now
250,000+ sites use our plugins! Become A Member

Create A New WordPress Theme File Without FTP

Jesse Nickles   |  22 Nov, 2015

Sometimes when you are designing a custom WordPress template you will need to create a new theme file. For example, you may already have common files such as index.php or single.php but you may require a new file, e.g. page-contact.php in order to design a custom contact page. Luckily, there is a VERY EASY way to do this even without FTP access!

1. Firstly, ensure that you have administrator access to your WordPress backend. This method will only work if you have admin access and are able to edit files under the APPEARANCE >> EDITOR context menu.

https://www.example.com/wp-admin/theme-editor.php

2. Next, determine the name of the theme directory your WordPress site is using. For example, if you are using the Avada theme, your theme directory would be wp-content/themes/Avada/ or so forth. If you are not sure, simply visit your homepage and select “view source” in your browser (CONTROL + U in Chrome/Firefox) and try to find some HTML code that confirms what your theme directory currently is (i.e. search “wp-content/themes” using CONTROL + F).

3. Finally, using PHP’s touch function, we will create a new theme file. Copy and paste the below code snippet into the very top (seriously, the very top) of your theme’s header.php file, and then click save.

Note: this file creation method is not limited to PHP files, and can be used to generate any file type.

<?php touch('wp-content/themes/YOUR_THEME/FILE_NAME.php');?>

4. After you click save, open your homepage in a new tab, and your new file should be created immediately. You can verify this by revisiting the file list under APPEARANCE >> EDITOR and checking to see that your new theme file exists.

5. Finish up by removing the code snippet from your header.php file, and then click save again. Keep in mind that as long as the code snippet is live, that file will keep being re-generated whenever someone visits your website. So make sure that you don’t begin editing your new file (adding code, etc) until you have properly removed the PHP touch snippet from your site.

CONGRATS! You are done. Just another good reason not to rely on FTP for so many things :)

Tags: , , , , , , ,

Last modified: 22 Nov, 2015https://www.littlebizzy.com/?p=5608

Results For Local Business, High Traffic, And E-Commerce.

Local Business

"After being hosted on GoDaddy for years, I didn't realize how negatively it was impacting my search traffic. Soon after moving to LittleBizzy, my homepage went from page 3 on Google to #1 world-wide for my target market, and I also reached the top 3 on Google Maps, with no additional SEO work."

Juliette S.

High Traffic

"Before moving to LittleBizzy, whenever our news website was featured on the Drudge Report, it often slowed to a crawl or even froze up during big traffic spikes. Now, that never happens anymore, and we've been able to focus on publishing more articles instead of worrying about our web hosting."

Tony H.

E-Commerce

"The research by Amazon is definitely true, because our slow WooCommerce store was bleeding sales. After LittleBizzy stabilized our performance and moved us closer to our target customers, we saw a measurable improvement in shopping cart checkouts, esp. during holidays... much better!"

Mohammed H.

No contracts, free migration, and free SSL forever. What are you waiting for? Order Hosting Now.

WordPress Gossip, Technical SEO News, And Other Goodies.

Free. Unsubscribe anytime.

Brands That Trust Our Software: