-
AuthorPosts
-
April 26, 2018 at 9:35 am #947139
i’m still experimenting with some filters – and i wonder that i can not influence the layout from boxed to stretched for a single page.
first i tried:
add_filter('avf_skin_options','custom_skin_option'); function custom_skin_option($styles){ if( is_page(26) ){ $styles['color-body_style'] = "stretched"; } return $styles; }
but that does not do the trick – then i thought maybe it is color scheme spezific so i tried:
add_filter('avf_skin_options','custom_skin_option'); function custom_skin_option($styles){ if( is_page(26) ){ $styles["Flower Green"] = array( "color-body_style" => "stretched" ); } return $styles; }
but even this does not overwrite the settings on Flower Green preselection on Enfold Options for that page.
is there a way to change from boxed to stretched for specific pages?April 30, 2018 at 7:31 am #948819Hey Guenter,
Thank you for using Enfold.
I didn’t even know that filter exists :D. Please try this one.
add_filter('avia_pre_prepare_colors', 'avia_pre_prepare_colors_mod', 10, 1); function avia_pre_prepare_colors_mod($options) { if( is_page(26) ){ $options['color-body_style'] = 'stretched'; } return $options; }
Best regards,
IsmaelApril 30, 2018 at 10:24 pm #949243thanks Ismael – i will give it a try.
PS that filter was not in the list i have from https://kriesi.at/documentation/enfold/hooks-and-filters/
Maybe a global search in enfold folder for “apply_filters” should be necessary. ;)May 1, 2018 at 4:16 pm #949571does not work this way.
May 1, 2018 at 4:26 pm #949574I am attempting to do the same thing, but rather than set the body as stretched, just change the primary color of the page. Below is my code in enfold-functions.php. It does not seem to be changing anything.
/* Load custom color scheme for each template file */ add_filter('avia_pre_prepare_colors', 'avia_pre_prepare_colors_mod', 10, 1); function avia_pre_prepare_colors_mod($options) { if ( is_page_template( 'bendfirepipesanddrums.php' ) ) { $options['colorset-main_color-bg'] = '#821b22'; } return $options; }
- This reply was modified 6 years, 7 months ago by jonerickson1011.
May 3, 2018 at 9:23 am #950578Hi,
One of these should work but I’m not sure if you can use it to change the option of a specific page because the option is loaded even before the page is queried.
// adjust $avia function ava_update_options() { global $avia; $avia->options['avia']['color-body_style'] = 'boxed'; return $avia; } add_action('after_setup_theme', 'ava_update_options'); // avia_filter_global_options function avia_filter_global_options_mod($options) { $options['avia']['color-body_style'] = 'boxed'; return $options; } add_filter('avia_filter_global_options', 'avia_filter_global_options_mod', 10, 1);
Best regards,
IsmaelMay 3, 2018 at 9:11 pm #951094No – please erase that answer- it messes all up in that test page.
All settings are gone ( except the functions.php entries) but quick css and logo and and.PS : no worry it is a test-page so not so important.
May 3, 2018 at 9:23 pm #951100All ok now – i got on dynamic_avia two merged css files : after beautfying i can extract the quick css again.
by the way : if we do not mark that option on performance: “Delete old CSS and JS files?” there are “backups” of the old settings?
how many will there be saved? that was my salvation now – but it should be limited to a certain number, so that the folder does not inflateMay 4, 2018 at 8:46 am #951446Hi,
Glad it’s all fine now. I have to check with the development team and get back to you on the CSS and JS files.
Best regards,
VinayMay 4, 2018 at 9:05 am #951452this is not so important – it is just i’m playing with the filters – and it is also for the pages, which I create here as a demonstration for other comrades. Sometimes then one has a boxed layout and then I do not always want to change the setting globally on my testpage to demonstrate something.
No hurry on thatMay 4, 2018 at 11:06 am #951522Hey!
Ok, I got a reply. The theme will create a maximum of 50 files (which should never amount to more than 25mb of web space) – the equivalent of a few uploaded images :)
As always it is interesting to see what you come up with.
Let us know if you have more questions.
Cheers!
VinayMarch 1, 2021 at 12:30 pm #1284386Hi,
So has there been any successful function to change the color scheme and layout (boxed/stretched) on a per page basis?
Thanks, WZ -
AuthorPosts
- The topic ‘Change Color body Style on one page’ is closed to new replies.