Tagged: colors, dynamic css
Hi from Germany,
imagine the following: I have properly set up my Enfold via a child theme. I used the splash green color scheme and changed the primary and the highlight color to something reddish. What I now want to achive is, that on certain pages of my website this two colours change according to the post id or the parent id. See the following starting point:
function ek_company_split(){
global $avia_config;
$companies = array();
$company = array(
'id' => 3399,
'primary' => '#699C00',
'secondary' => '#99CC00'
);
// more companies to follow here.
$companies[] = $company;
$current = get_the_id();
$parent = wp_get_post_parent_id( $current );
$company_page = false;
$css_keys = array('socket_color', 'footer_color', 'alternate_color', 'main_color', 'header_color');
foreach ($companies as $firma){
if($firma['id'] == $current || $firma['id'] == $parent){
$company_page = true;
}
}
if($company_page){
// setup some dynamic styleshet here
}
}
add_action('template_redirect', 'ek_company_split');
Any Idea how to realize that? Couldn’t I Ieverage the dynamic-css.php somehow to generate some inline styles that overwrite the global color scheme only on the pages I desire?
I hope that I could express myself well enough. Help is gladly appreciated!
Hi André!
That’s kind of bordering on custom work. It would be best to hire a freelancer to help you out with that customization.
Or you can consider using just CSS for this. You can target a page by it’s ID like so.
.page-id-1167 a { color: red !important; }
Cheers!
Elliott