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
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.
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.
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 :)Last modified: 22 Nov, 2015
"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.
"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."Steve G.
"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.