mengland Posted January 8, 2017 Share Posted January 8, 2017 Hello PHP freaks, I'm new to the forum but am here due to an problem I haven't been able to solve. I am working on something which I believe is a simple problem / solution. I'm still a beginner at PHP and love the language so far. I'm trying to override a value in my WordPress Theme so that it outputs an h3 instead of h5. If anyone would be able to walk me through a solution I'd be really grateful. I'm looking forward to learning from my mistakes on this one. I would like the 'selector' line to read as 'selector' => '.et_pb_toggle.et_pb_toggle_item h3', /* Source Code from Parent Theme Toggle Found on line 7170*/ et_pb_print_module_styles_css( 'et_pb_toggle', array( array( 'type' => 'font-size', 'key' => 'title_font_size', 'selector' => '.et_pb_toggle.et_pb_toggle_item h5', ), array( 'type' => 'font-style', 'key' => 'title_font_style', 'selector' => '.et_pb_toggle.et_pb_toggle_item.et_pb_toggle_open h5', ), array( 'type' => 'font-style', 'key' => 'inactive_title_font_style', 'selector' => '.et_pb_toggle.et_pb_toggle_item.et_pb_toggle_close h5', ), array( 'type' => 'font-size', 'key' => 'toggle_icon_size', 'selector' => '.et_pb_toggle.et_pb_toggle_item .et_pb_toggle_title:before', ), array( 'type' => 'padding', 'key' => 'custom_padding', 'selector' => '.et_pb_toggle.et_pb_toggle_item', ), ) ); Here is what I tried that didn't work and I have a few ideas but am not really sure how to execute them properly. As this code below gave a PHP error. Fatal error: Call to undefined function et_pb_toggle() in /home/content/p3pnexwpnas05_data01/49/3127149/html/wp-content/themes/Holmes Child Theme/functions.php on line 17 //modifies array for toggle switching h5 => h3 function hms_module_modifier() { et_pb_toggle( array( 'selector' => '.et_pb_toggle.et_pb_toggle_item h3' ) ); } //Runs module modifier hms_module_modifier(); Quote Link to comment https://forums.phpfreaks.com/topic/302895-wordpress-changing-an-array-value-in-parent-theme-from-child-theme/ Share on other sites More sharing options...
maxxd Posted January 9, 2017 Share Posted January 9, 2017 Look for a call to the function apply_filters() right around this area. The apply_filters() and do_action() functions are how WordPress allows themes and plugin to programmatically override core and extended functionality. If there is an apply_filter() call, I would think it would allow you to change the contents of the array the above function is creating. Of course, without knowing what theme you're using or what the rest of the code around this function looks like, I can't guarantee anything. Quote Link to comment https://forums.phpfreaks.com/topic/302895-wordpress-changing-an-array-value-in-parent-theme-from-child-theme/#findComment-1541220 Share on other sites More sharing options...
mengland Posted January 10, 2017 Author Share Posted January 10, 2017 Look for a call to the function apply_filters() right around this area. The apply_filters() and do_action() functions are how WordPress allows themes and plugin to programmatically override core and extended functionality. If there is an apply_filter() call, I would think it would allow you to change the contents of the array the above function is creating. Of course, without knowing what theme you're using or what the rest of the code around this function looks like, I can't guarantee anything. Thank you for sharing this I'll look into this and see if I can find the filter. I do believe there is a filter being applied in this scenario. I'll report back once I have something to share. Quote Link to comment https://forums.phpfreaks.com/topic/302895-wordpress-changing-an-array-value-in-parent-theme-from-child-theme/#findComment-1541253 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.