Skip to content

Commit

Permalink
functions.php - add jer_backtrace_contains_function for fun
Browse files Browse the repository at this point in the history
  • Loading branch information
jerclarke committed Aug 3, 2017
1 parent 017f8bb commit e62536a
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function simian_uprising_twenty_seventeen_enqueue_child_styles() {
/**
* Enable shortcodes in widgets
*/
add_filter('widget_text', 'do_shortcode');
add_filter( 'widget_text', 'do_shortcode' );

/**
* TODO: Find a way to automatically insert widgets from sidebar-summary into the sidebar sidebar
Expand Down Expand Up @@ -83,4 +83,23 @@ function jer_twentyseventeen_wp_head($param) {

echo $output;
}
//add_action('wp_head', 'jer_twentyseventeen_wp_head');
//add_action('wp_head', 'jer_twentyseventeen_wp_head');


/**
* Check if $function is in the call stack in debug_backtrace()
*
* Needed to check if a given filter (e.g. 'wp_trim_excerpt') is a function ancenstor
* to disable functionality (e.g. stop a wp_content filter from affecting empty excerpts).
*
* @param type $function
* @return boolean
*/
function jer_backtrace_contains_function($function) {
$backtrace = debug_backtrace();

foreach ($backtrace as $key => $function_details ):
if ($function == $function_details['function'])
return true;
endforeach;
}

0 comments on commit e62536a

Please sign in to comment.