Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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'));
  }
share|improve this question

1 Answer 1

up vote 0 down vote accepted
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'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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