I am using a theme that has frequent updates and wish to use a child theme to conserve all of the settings (menus, backgrounds, RSS, Facebook links , Contact info , etc. I have it set up with a child theme directory as per the codex with style.css and some of the customizations do get saved. My problem is that menu creations , links , custom pages don’t get saved after an update. For instance what files would I put in the child theme to save the menus ? admin.php? What would the file structure be like. Does it use the same process as style.css with the theme info then the include for the parent style.css then the customizations after? The codex is very bare bones when it comes to this. Also how would I redirect the image folder from the parent theme image directory to the images directory in the child theme ? I am having difficultly finding the correct url to use in header.php that I also have a copy of in the child theme.
Thank you for any help with this
Custom menus are saved by WordPress. Since a child theme is considered a new theme by WordPress’ standards, though, you’ll have to remake any custom menus from your Dashboard and assign them to the appropriate locations, just like you did when you were using the parent theme. You would also have to do the same thing with any widget areas, as well.
Re: your image problem.
get_template_directory_uri()should return the parent theme’s directory, so in your child theme you could use, for example:
<img src="<?php echo esc_url( get_template_directory_uri() . '/path/to/image.jpg' ); ?>"and it would return the appropriate image from the parent theme’s image directory.
There is no way to have the menu customizations stored in the child theme instead of the parent theme ? Also I want to use the images directory that I created in the CHILD theme not the images directory in the parent theme but get_template_directory_url always returns the parent images directory. How would I get it to return the child images directory instead ? I have full ftp and shell access to the server the website is on.
Thank you for your quick reply Stephan 🙂
Re: your menu customizations. Are you referring to the content of your menus (links, pages, categories, etc.) or the styling of your menus (colors, fonts, etc.)?
Re: your image directory. I misunderstood your question at first, my apologies. To return the child theme’s assets, you would use
For instance with the menu creation , I would like that information stored with the child theme, storing the attributes of the menu items would be a huge plus as it will be quite detailed once it is complete.
I have WordPress design for dummies , Professional WordPress design and development , WordPress pushing the limits , PHP and MySql for dynamic websites and CSS3 the missing manual to help figure out how to do this. Along with the Codex , the same information is given with just a partial list of files that can be stored in the child and “make the same directory structure but it never goes beyond that with any details.
Sorry, but I’m still not following you. Are you referring to the content of your menus (links, pages, categories, etc.) or the styling of your menus (colors, fonts, etc.)?
The menu structure and naming and where each menu item is linked to is the most important
That should have been saved for you. Go to your Dashboard, select Appearance > Menus, and check the “Select a menu to edit” dropdown. Your menu should be in that list. Then go to the “Manage Locations” tab and assign that menu to the appropriate location using the dropdown menu.
I just noticed that the menu structure is not saved with the themes at all and feel dumb , lol. Is there a tutorial on how to put the different files correctly into a child theme ? eg , header.php , footer.pho , etc ?
Generally speaking, the only files you need to include in a child theme are the files that should be different from the parent theme. If you like the general design of your theme but you’d like to use different colors or fonts, all you need to do is include a new stylesheet. Your question is quite broad, though, and if you could narrow it down to what specific changes you’d like to make, it would be a lot easier to help. Also, I suggest making separate threads for each question. It makes it easier to help. What theme are you using?
The theme is New-Commerce by F5 THemes. (http://f5themes.com/) I would like to retain the header images and background ground images as well as their settings. The site I am working on is can.wandasweb.com there is a corresponding usa.wandasweb.com these are place holder URLs so that temporary URLs don’t have to be used which seems to break many plugins once the temporary URL is changed to the permanently published one. I have not put in any shopping data so the sliders are not showing yet.
Thank you very much Stephen , this is very helpful and appreciated
It doesn’t look like you need a child theme for anything, to be honest. It looks like can.wandasweb.com is using a plugin called Background Manager[*] to set the background image. You could use the same plugin and the same image on usa.wandasweb.com to get the same effect.
[*] It looks like the plugin is no longer supported or maintained. It will probably still work for the immediate future, but you may wish to search for an alternative plugin.
The two flags and their links , the front page header image is also custom. The menu as well is modified to remove the border from the top and bottom. How would I retain these settings ?
As I do not have access to your chosen theme, I cannot say how to add the header image from usa.wandasweb.com. I would ask your theme vendor for assistance on that front. But I can say that your two sites are exactly the same, except that can.wandasweb.com has a background image that usa.wandasweb.com does not. If you install the Background Manager plugin I mentioned in my previous post and use the same background image and the same plugin settings, your two sites will look the same.
It is losing the settings when the theme is updated that I am concerned about. I am working on getting can.wandasweb.com set up and then once complete will be redirecting http://www.wickedwandas.ca to this site so I want the updates as painless as possible before this.
Your background image will be set by the plugin, so no worries there. Your menu is preserved by WordPress, so no worries there. From what I’ve seen on your two sites, it doesn’t look like anything would be removed by a theme upgrade.
- The topic ‘Steps to creating a child theme’ is closed to new replies.