Home » WordPress » Adding a WordPress PHP file to a theme without FTP

Adding a WordPress PHP file to a theme without FTP

 

Looking to add a  php file to your theme, but no FTP then try this. Some hosting servers will not let you do this for security reasons

In WordPress’ Dashboard’s  menu:

  • Choose Appearance/Editor then select your function.php  or header.php file.
  • At the top  add
    <?php touch(‘wp-content/themes/yourthemefolder/whatever.php’); ?>
    Obviously yourthemefolder and  whatever.php should be changed to your theme’s folder name and the new file name respectively.
  • Click Update and then view one of your web pages, this will execute the php line you just added.
  • Switch to the WordPress’ Dashboard’s  menu  and choose  Appearance/Editor again. You should now be able to see your new file in the list.
  • Re-select and edit the  function.php  or header.php file you used  –  remove the line you added above and then press Update.
  • Select your whatever.php file and start adding your content as normal.

This is useful to create different page layouts for the content area, i.e. page templates.

 

Support