-
AuthorPosts
-
December 13, 2017 at 7:40 pm #888519
i don’t want to loose my modifications i put in on next update – so is there a way to have a child-theme register-backend-advanced-styles.php ?
(for example – i wanted to have the same settings for blockquote as on h1 ( including font-family etc). So i did change the edit array)
Thanksto be precise: there is an include instruction in register-admin-options.php :
include('register-backend-advanced-styles.php');
is there a hook to have not loaded that file and include a child-theme file here?
- This topic was modified 7 years ago by Guenni007.
December 18, 2017 at 10:39 pm #890272Hey Guenter,
As that is something not so simple, I have assigned our main developer to the ticket.
He will do take a look and assist if possible.Thank you
Best regards,
BasilisDecember 19, 2017 at 11:19 am #890408Hi,
A direct hook at the moment – no.
But $advanced is assigned to $avia_elements[] in enfold\includes\admin\register-admin-options.php line 1173ff and you have in file enfold\framework\php\class-superobject.php line 118 the following filter:
if(isset($avia_elements)) $this->option_page_data = apply_filters( 'avf_option_page_data_init', $avia_elements);
If this does not help let me know and we can add filters to change the path to the include files in the core for the next release.
Best regards,
GünterDecember 19, 2017 at 4:22 pm #890557yes what i thought if we can redefine the path to it
in register-admin-options.php there is that
include('register-backend-advanced-styles.php');
yes i can change it here by manual typing – but than it will be lost on updating the parent theme.
but maybe there is a way to change the edit array of a given setting via hooki changed to have the option to set for blockquote the font-family (which is missing on default) f.e. :
$advanced['blockquote'] = array( "id" => "blockquote", //needs to match array key "name" => "<blockquote>", "group" => __("HTML Tags",'avia_framework'), "description" => __("Change the styling for all <blockquote> tags",'avia_framework'), "selector" => array("#top [sections] blockquote"=> ""), "sections" => true, "hover" => false, "edit" => array( 'font_family' => array('type' => 'font', 'name'=> __("Font Family",'avia_framework'), 'options' => $google_fonts), 'font_size' => array('type' => 'size', 'range' => '8-80', 'name'=> __("Font Size",'avia_framework')), 'line_height' => array('type' => 'size', 'range' => '0.7-2', 'increment' => 0.1, 'unit' => 'em', 'name'=> __("Line Height",'avia_framework')), 'font_weight' => array('type' => 'select', 'name'=> __("Font Weight",'avia_framework'), 'options' => $weight), 'text_transform' => array('type' => 'select', 'name'=> __("Text Transform",'avia_framework'), 'options' => $transform ), 'color' => array('type' => 'colorpicker', 'name'=> __("Font Color",'avia_framework')), ) );
December 20, 2017 at 12:05 pm #890742Hi,
I have added a filter:
/** * Allow to include a user defined file to add or alter backend styles * * @since 4.2.1 * @return string full path to the include file ( not a relative path !!! ) */ $custom_path = apply_filters( 'avf_register_custom_backend_styles', '' ); if( ! empty( $custom_path ) && file_exists( $custom_path ) ) { include_once $custom_path; }
The modified file you find here for download:
Should be included in the next update, when Kriesi approves it.
In your file you only need to modify or add the values you need.
Best regards,
GünterDecember 20, 2017 at 2:41 pm #890771so i do create a folder on child-theme ( maybe : includes) –
i make a file f.e: register-custom-advanced-styles.php and upload it to that child-theme/includes foldercontent is f.e.:
<?php $advanced['blockquote'] = array( "id" => "blockquote", //needs to match array key "name" => "<blockquote>", "group" => __("HTML Tags",'avia_framework'), "description" => __("Change the styling for all <blockquote> tags",'avia_framework'), "selector" => array("#top [sections] blockquote"=> ""), "sections" => true, "hover" => false, "edit" => array( 'font_family' => array('type' => 'font', 'name'=> __("Font Family",'avia_framework'), 'options' => $google_fonts), 'font_size' => array('type' => 'size', 'range' => '8-80', 'name'=> __("Font Size",'avia_framework')), 'line_height' => array('type' => 'size', 'range' => '0.7-2', 'increment' => 0.1, 'unit' => 'em', 'name'=> __("Line Height",'avia_framework')), 'font_weight' => array('type' => 'select', 'name'=> __("Font Weight",'avia_framework'), 'options' => $weight), 'text_transform' => array('type' => 'select', 'name'=> __("Text Transform",'avia_framework'), 'options' => $transform ), 'color' => array('type' => 'colorpicker', 'name'=> __("Font Color",'avia_framework')), ) );
so what do i do now ?
December 20, 2017 at 3:47 pm #890812Hi,
In functions.php of the child theme add the filter hook:
add_filter( 'avf_register_custom_backend_styles', 'my_include', 10, 1 ); function my_include( $path = '' ) { return get_stylesheet_directory() . '/includes/myfile.php'; }
LG
GünterDecember 20, 2017 at 4:36 pm #890835hm ? i tried it but only :
add_filter( 'avf_register_custom_backend_styles', 'my_include', 10, 1 ); function my_include(){ $path = get_stylesheet_directory().'/includes/register-backend-advanced-styles.php'; return $path; }
works than for me – in the manner that it does not append it totaly replaces parent file – this will be ok for me. !
So i made a copy of the original file and uploaded an edited file to child-theme includes folderDecember 21, 2017 at 11:59 am #891102Hi,
I rechecked it on my install – the filter above works fine for me and you only need to update the necessary array elements you need like you posted in https://kriesi.at/support/topic/a-way-to-have-an-own-register-backend-advanced-styles-php-in-child-theme/#post-890771
As the new file is included, $advanced is in the scope of both files and can be accessed and modified.
That was the reason why I added an include of a file and not a filter with data structures (see https://kriesi.at/support/topic/a-way-to-have-an-own-register-backend-advanced-styles-php-in-child-theme/#post-890408) to allow more flexibility in altering the values of all three included style files above.
Best regards,
GünterDecember 22, 2017 at 11:13 am #891533hm don’t know where my fault was. it now works as expected. % – )
maybe there was a fault by transfering the php-file name manually ;)
can be closed
December 23, 2017 at 5:03 am #891786 -
AuthorPosts
- The topic ‘A way to have an own register-backend-advanced-styles.php in child-theme’ is closed to new replies.