0

I'd like to replace an action in a theme with my own version in a child. In this case, the theme hooks into wp_head to add it's own links. My own functions.php resides in the child theme and looks like this:

global $SMTheme;
remove_action('wp_head', array($SMTheme, 'headtext'));
add_action('wp_head', 'custom_headtext');

Unfortunately, it's not working yet and I'm fairly new to this. This is how the theme adds it's action:

class SMTheme {
  var $options;

  function SMTheme() {
    // some unrelated code here         
    include TEMPLATEPATH."/inc/settings.php";
    $reset='';
    // if (current_user_can('administrator')) {}
    $this->getparams($settings,$reset);
    add_action('wp_head', array(&$this, 'headtext'));
  }
0
include TEMPLATEPATH."/inc/settings.php";

is your problem.

TEMPLATEPATH

is used by the parent theme

For child themes use

STYLESHEETPATH

so your code will be

include STYLESHEETPATH."/inc/settings.php";

Alternatively you can use

get_stylesheet_directory_uri().'/inc/settings.php'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.