I have purchased the Honest theme. I have also created a child theme for some look/feel changes. In my child theme I have also created an additional custom post-type.
For some reason the Honest theme options are not available in my child theme dashboard. Since I have a custom post-type I don't want to simply use the parent theme because any updates will overwrite my custom post-type.
Is there a way to make the parent theme options available in a child theme? If so, can you point me toward a direction of that solution?
Hard to say without seeing the actual source code.
If you're willing to use the parent theme, you can put the code that registers the custom post type in a plugin of your own. Must-use plugins are great for this: http://codex.wordpress.org/Must_Use_Plugins
You can also put your style mods there, e.g. enqueue an extra stylesheet that overrides the styles from the parent theme: http://codex.wordpress.org/Function_Reference/wp_enqueue_style
Related
For the first time I am trying to setup a wordpress child theme. The parent has a complicated templates for custom post types and header.php and footer besides stylesheets and javascript files etc.
The child theme only needs to change the css (for now). My child theme only has style.css and functions.php.
I already have a single-product.php for a custom post type product in the parent theme folder. That is not getting loaded automatically from the parent. Please suggest what is required to get this working.
Thanks.
Not really the best solution but can help.
Copy header.php into the child theme and put your css in the <head> section. Remember to enclose your css with <style>custom-css{...}</style>
I am trying to understand how to use a Child Theme in wordpress.
I am afraid that something will go wrong in the process of developpment because I haven't completely understood how to use the child theme or its integration wasn't done properly.
My confusion comes after I create the child theme and by adding the style.css and functions.php.
At this point, can I make any changes that I want to the child theme and it will still work?
For example,
After I modify the front-end of the website with the use of the child theme, I want to add some forms that will insert data into the database.
Do I have to implement any php files from the parent-theme in order to make this work ?
Or do I treat my child-theme as a fresh theme (blank canvas) and code the back-end however I would like ?
Thanks
Think of the child theme as a layer on top of the parent theme. By default (if you add nothing to the child theme other than a style.css file), all the templates from the parent theme will be used. The only thing you have to have is the style.css file. If you wanted to override the page.php template for instance, you would simply just make a page.php file in your child directory and WordPress will use that template instead of the parent template. Same goes for any template file or template part.
You can have a functions.php file in your child theme and it will be included in addition to the parent functions file.
Usually the parent's style.css file would be enqueued before the child's style.css file, but it depends on how those files get enqueued. The system is quite flexible.
Your child theme is not a blank canvas. It inherits style.css, functions.php and all the post/page templates from the parent theme. The style.css file of your child theme will load after that of the parent theme, thus enabling you to add more CSS rules. The functions.php file of your child theme will load before the parent's functions.php file.
The child also inherits all the templates from the parent. However, if a template exists in the parent and you create it in the child the child theme's template will completely override the parent's template. For more information on parent-child theme relationship I highly recommend that you check the official child themes documentation.
I want to override the parent theme option in child theme, so how can I do this in using code inside my child theme.
My problem is this,
I have use the ready-made word-press theme now, I want the some new options in theme options using my child theme so is there any way to override theme options.
I have also include my theme optional file like below:
include (CHILD_DIR.'admin/theme-options-dependency.php');
Thanks in advance.
First of let me know which theme you have used. In theme you don't need to override theme option just check parent theme option code you have find lots of action and filter when theme option register. You just use that filter & action and add your extra option with filter.
I want to edit some stuff on my website. I'm using a child theme and I plan to change some CSS and do some structural changes. I know the CSS is easy to change, as I only need to call the names of the classes or IDs and give the new values.
But, if I want to change things around in html, do I need to copy the whole code? Will I lose every change when the theme updates (as in: i copied and pasted the older version and now I need to copy and paste the new version)?
I don't know much about the names of things and how to describe them properly.
Make copies of the theme files in the parent theme you want to modify - such as index.php, category.php, etc - and move those to the child theme and edit them. The copies in the child theme will be used by WordPress rather than the same-named files in the parent. This includes file in folders, i.e. /css/style.css, so duplicate the file structure in the child theme, if needed.
The child theme will continue to use those files, even if/when the parent theme get updated. And that also means your child theme edits won't disappear, unless there are major structural/functional changes to the parent theme.
One exception to child theme file usage is functions.php:
Unlike style.css, the functions.php of a child theme does not override
its counterpart from the parent. Instead, it is loaded in addition to
the parent’s functions.php. (Specifically, it is loaded right before
the parent’s file.)
See http://codex.wordpress.org/Child_Themes
Taken from Wordpress Doc - Child Themes:
If you want to change more than just the stylesheet, your child theme
can override any file in the parent theme: simply include a file of
the same name in the child theme directory, and it will override the
equivalent file in the parent theme directory when your site loads.
For instance, if you want to change the PHP code for the site header,
you can include a header.php in your child theme's directory, and that
file will be used instead of the parent theme's header.php.
Wordpress Child Theme can't have a child theme itself. It's not supported by Wordpress. I had the same problem before and after some searches I found this article.
It explains about creating a grandchild theme; from the article:
The solution is surprisingly simple. Instead of editing the child
theme, create a grandchild theme. It’s very similar to creating a
child theme, except you do it via a plugin. You add your custom
functions to the plugin, just as you normally would in functions.php
(though remember your plugin will be called much earlier than
functions.php, so you’ll need to make sure that any code in your
plugin only runs when an action is fired). Use the wp_register_style
and wp_enqueue_style functions to add your CSS (by default a
grandchild theme will add your CSS to the CSS of the parent or child
theme, but you can change this behaviour by using the wp_dequeue_style
function). Finally filter the result of the get_query_template
function to control which PHP files are executed when a page is
requested.
It's not really a child theme of a child theme, but a plugin including calls to add_filters or something similar to override the behaviour of the child theme. In this way upgrading child / parent themes will not affect the customisation you've made.
I am currently changing a parent theme in wordpress by creating a child theme and I am just checking if this is considered bad form and if it will have any repercussions if/when the theme is updated.
e.g. The parent theme's header.php has an id called #menu. This has a lot of styles in the parent's style.css file. To avoid having to alter everything to do with the #menu I changed the id to #menu-child in the child theme's header.php file and added my own styles, this has made it a lot quicker but I'm unsure if it will screw the styles/theme up if/when it is updated.
Thanks in advance.
Short answer: No.
Your child theme template overwrites the main theme template and still does that after an update. So your changes will stay in place. But if the parent theme uses the #menu for stuff (styling, js...) these changes and current adjustments will not have any effect in your child theme anymore. So if you want your own changes and all functionalities and styling of the parent theme you should not remove the id, but add your own class.
Of cause theme developers can sometimes mess up the structure or make changes themselves which require you to alter your child theme templates as well (like changing the whole structure).