Copying Theme Files to your Child Theme from the WP dashboard without FTP

December 11, 2019
copying-theme-files-to-your-child-theme-from-the-wp-dashboard-without-ftp Theme Builder Layout

Published MAR 4, 2016, Updated DEC 11, 2019

In this post we’re going to look at how you can copy theme files to your child theme from the WordPress dashboard, without FTP access. Often when creating a child theme, you add only the necessary functions.php & style.css. As development goes on you may have need to add more files; the header.php for example.

Normally, this would involve a trip into your favourite FTP client to copy and paste the file from the parent theme directory into the child theme, but using this tutorial, you can now copy parent theme files into your child theme without leaving your WordPress dashboard.

What is FTP?

FTP stands for File Transfer Protocol. It’s the standard network protocol that’s used to transfer files between a client and a server over the Internet. Files are transferred using separate control and data connections that are established with an FTP client such as FileZilla.

FTP can be set up on your server using cPanel on your web host’s server. For information about setting up FTP accounts for your website with cPanel, see the article How to Setup FTP Access to your Site Using cPanel.

Setting up FTP on cPanel takes several steps and it requires you to work with files in multiple locations with multiple apps. It’s much easier to just work within WordPress.

Fortunately, there are several ways to access the files and use FTP without having to access your cPanel on your server. The files can be created manually from your PHP files, or you can access FTP with plugins and never have to leave WordPress. Sound good? Let’s start!

1. Creating a new child theme file from the dashboard

Our end goal is to copy all of the information from the current header.php in the parent directory into the child theme, but first we need to create the new file so we have a place to put it.

Make sure your child theme is active. Then you need to add a touch(); function to one of your php files. If the only php file you currently have is functions.php then add the code there, but if you have a footer.php file already, then add it there instead. The only real requirement here is that the file runs when you load the home page.

You can find both files (if you have them) by going to appearance > editor in your dashboard menu.

Wherever you put it, make sure it is somewhere between the opening ‘<?php’ and the closing ‘?>’ tags… here’s the code you need to add.

touch( get_stylesheet_directory() . '/header.php' );

Save the changes to the file and then visit your site’s home page so that the new function can run. That one line of php is going to look for that file and when it doesn’t find it, it’s going to create it. This same technique can be used for any file, just change the ‘/header.php’ part to whatever the file name is you want to create.

2. Copying the file content from the parent theme

So at this point you should be on your home page right? Head back into your theme editor and you’ll notice that the new header.php has been added to your child theme. Allow your self a second to go “oh yay! That’s awesome :D” and then use the option in the top right hand corner to view the Divi parent theme files instead.

Open the Divi header.php and select all of the code. Copy it and then reselect your child theme in the top box. Open your newly created header.php and paste the code into the currently empty file.

Save your changes and then head back to wherever you originally put the touch(); function and delete it, you don’t need it anymore.  Aaaand you’re done!

That’s it. You copied a file from the Divi parent theme into your child theme folder and you left WordPress a grand total of ZERO times. I hope you find this useful!

Plugins to Access FTP

One easy way to access FTP is by using a plugin. Of course, plugins can be risky. For example, if you make a change to your functions.php file that kills your website (white screen of death), you’ll lose access to the frontend and backend of your WordPress website and the FTP plugin. This means you won’t have access to the plugin to fix the problem. For this reason, we recommend using a standard FTP connection.

If you do plan to use an FTP plugin, here’s a look at a couple of free plugins that make it easy to use FTP without having to dig into your server settings in cPanel. They add admin panels to the WordPress dashboard where you can create the FTP accounts. They also add a lot more features to give you even more control over your files.

File Manager

File Manager makes it easy to upload, edit, download, zip, copy, paste, and delete files and folders in the WordPress dashboard. Upload files to the media library. You can also backup and restore your files.

It includes a code editor with a syntax checker so you can review your code before saving the file. Right-click on any file to get detailed information. The file manager allows you to share the files via email. Other features include search, preview, view as PDF, automatic file resizing, SFTP, trash, file type control, archives, edit the root path directory, view files as icons or lists, drag and drop, backup and restore, upload to the media library, and more.

The pro version adds shortcodes with custom attributes for the frontend, a private folder that you can restrict access for different users and user roles, email notifications, etc. Premium addons include integration for DropBox, Box, OneDrive, Google Drive, GitHub, and Slack.

File Manager Advanced

File Manager Advanced lets you upload, edit, copy, zip, download, and delete files. It gives you access to the files both inside and outside of the WordPress root directory. You can edit the root directory path and hide the real path of the files. It uses a local file system rather than a database.

It adds a rich context toolbar. View a preview, preview as PDF, view as list or icons, see archives, edit images, view media, search, select multiple files, move files with drag and drop, sanitize file names and file paths, view history, etc. Upload features include auto-resize on upload, folder upload, chunked file upload, etc.

The pro version adds shortcodes for logged in and non-logged in users to allow access to the frontend tools based on users and user roles. It also includes user and role restrictions, adds a private folder and a personal folder, and lots more.

Source

Share this article:
 

eHost-square-ad Theme Builder Layout

We’re listening.

Have something to say about this article? Share it with us on Facebook, Twitter or LinkedIn:

SHARE IT HERE:

Related Posts

designcap-overview-and-review Theme Builder Layout

DesignCap Overview and Review

DesignCap is an online app that makes it easy to create high-quality graphic designs without needing advanced graphic design skills. The features are customizable and it includes lots of templates, photos, and illustrations for your projects. Save your designs in the...

fixed-headers-floating-elements-draggable-anchors-and-more Theme Builder Layout

Fixed Headers, Floating Elements, Draggable Anchors And More!

Introducing The Divi Theme Builder Posted on October 17, 2019 by Nick Roach in Theme Releases The Divi Builder Unleashed Divi Is No Longer Just A Page Builder. Enjoy Complete Control Over Your Entire Website With The Theme Builder. Today is a day that many of you have...

Get ALL Your SEO, WordPress & Divi News

Join Our Daily Roundup

SEO News and More

SEO News and More

Subscribe ToThe Weekly SEO Trade News Updates

Get the latest SEO, SEM and SMM marketing intel, tips and tricks from one of the best SEO Gurus online. 

Every Tuesday morning we send out an aggregated email listing all new posts on SEO Trade News.

Excellent! Now check your email to confirm your subscription.