Adding a Function without a child theme?
-
Hi,
Is there a simple way of adding a function to the Graphene theme without compromising future updates other than via a child theme? I want to add the following function(which I found in the forum):
function two_sidebar_homepage(){
global $graphene_settings;
if ( is_home() ) {
$graphene_settings['column_mode'] = three_col_center;
}
}
add_action( 'template_redirect', 'two_sidebar_homepage' );It’s purpose is to allow two sidebars on the front page and one on the rest.
It’s a pity, given all the people who’ve asked for this functionality on the various forums, that it’s not available out of the box, from either WordPress or the theme. Still, this little function works fine. Its just that it’s a pain to have to create a child theme and then set all the Graphene options again.
Cheers
Phil
Mod
The short answer to your question is no. If you want custom functions, you have to use a child theme.
Quote:It’s a pity, given all the people who’ve asked for this functionality on the various forums, that it’s not available out of the box, from either WordPress or the theme.This isn’t a WordPress issue, it’s a theme issue. Themes control the appearance.
Quote:Its just that it’s a pain to have to create a child theme and then set all the Graphene options again.You can export Graphene’s options, and then import them to your child theme. This should keep anything you have to set up again to a minimum.
Additionally, using a child theme means that if you have a lot of settings (colors, etc.) you can move these to a child theme stylesheet, which will both speed up your site and reduce your server load.
At one point, WordPress used to reset all your widgets when you changed themes, but now it keeps track of them, so that shouldn’t be an issue any more.
Mod
Should work a treat. Let us know if you run into any problems.
Quote:Is there a way of adding the code in via an Action Hook within the Advanced Graphene Options rather than a child theme? As you can probably tell from my question I don’t fully understand how they work 🙂I meant to say: Is there a way of adding the code in via an Action Hook within the Advanced Graphene Options
Mod
Not really. A function like that needs to be loaded with all the rest of the functions when the theme is called.
Viewing 8 posts - 1 through 8 (of 8 total)
- You must be logged in to reply to this topic.