In my post Adding a screenshot for a WordPress child theme I showed you how to create the screenshot for a child theme, and where to upload it to make it available in “Appearance” > “Themes” inside your admin area.
But I also mentioned on that post that I´d thought of a way to put the new screenshot in its appropriate location without the need for a FTP access, to be explained on a new post.
So let´s talk about that now.
A screenshot is just an image, so…
The idea is pretty simple: since a screenshot is just an image, why don´t we just use the WordPress media manager to upload it?
We can not upload our new screenshot the same way we would upload any other image we are going to use in our site though. Why? because when we upload an image, it is stored in the default upload folder of our site ( wp-content/uploads, if we didn´t change anything from the standard WordPress installation) while, as we saw on my previous post, our screenshot should be placed directly into our child theme folder, side by side with the style.css of our child theme.
Therefore before uploading the screenshot we need to change the destination folder of the WordPress media uploader. This used to be as simple as going from our dashboard to “Settings” > “Media” and typing the desired destination folder on the “Store uploads in this folder” field, under “Uploading Files”. But this has changed since the release of WordPress 3.5, so now we don´t have that option available anymore in the standard WordPress installation. Under “Uploading Files” we only have the option to check “Organize my uploads into month- and year-based folders“:
So how do we change the uploaded media folder now?
Once again we can make use of a plugin to solve our problems. In this case we will use WP Original Media Path. What this plugin does is just what we need, it gives us back the option to change the upload folder:
Once you install this simple plugin, under “Settings” > “Media” you will get this:
Those two new options are the same we used to have available before the WordPress 3.5 release. The second one (“Full URL path to files“) is great for storing our images in a custom subdomain, but we won´t need it for the purpose of this post.
As for the first option, to be able to upload our child theme screenshot to our child theme folder we need to type in the field “Store uploads in this folder” the following:
where “childthemefolder” is the name of our child theme folder. For example, if we want to upload the screenshot for the child theme we used on previous posts (Happy New 2013), we should type “wp-content/themes/happy-new-2013” and finally click on Save Changes.
All we have to do now is go to “Media” > “Add New” and upload the image we created for our screenshot. Remember it has to be named “screenshot”, as explained in our previous post Adding a screenshot for a WordPress child theme.
After uploading the image, go to “Appearance” > “Themes” and you´ll see your screenshot representing your child theme.
A word of caution
Right after you´ve checked that your screenshot was correctly uploaded to your child theme folder, and before you do anything else, please make sure that you change the upload folder back to “wp-content/uploads” (or whatever folder you were using before, if you had a custom folder). Otherwise you would end up uploading every new image to your child theme folder instead of the folder where you should have your media stored.
Remember we have been “cheating” just for the sake of avoiding the need for a ftp upload, so right after we “cheated” we must leave everything as it was before.
I know this has not been a very orthodox WordPress post, but cheating is not so bad as long as we know what we´re doing and we take some advantage from it. Did you enjoy it? Do you have anything to say about it? I´d be pleased to read your comments, so please go ahead.
Latest posts by Luis Alejandre (see all)
- Child Theme Detection Just Got Better - 17 January, 2017
- Child Themes: Enqueuing the parent theme stylesheet instead of using @import - 31 December, 2016
- Add functions to your WordPress child theme (5) – WordPress Filters - 8 August, 2016