Override Theme-Options.php file

I am having a difficult time removing the calling from my parents theme-options.php. My problem is this: My parent theme calls for the logo not from the header.php which I could easily replace but from the theme-options.php by placing the url path to the image like so
require ( get_template_directory() . '/settings/theme-options.php' );

I want to “unrequire” this call in the child theme and add a function to call
require ( get_stylesheet_directory() . '/theme-options.php' );

Read More

This way I can modify the options file and remove the call to the url. I have had a similar problem before and fixed it by using the unregister function but I am not sure on how to “unrequire” this call to the file.

Any help would be greatly appreciated.

After searching a little deeper there is a function that calls the default values like so :

function max_magazine_default_options() {
$options = array(
    'logo_url' => get_template_directory_uri().'/images/logo.png',
    'favicon_url' => '',
    'rss_url' => '',
    'show_slider' => 1,
    'slider_category' => 0,
    'show_carousel' => 1,
    'carousel_category'=> 0,
    'show_feat_cats' => 1,
    'feat_cat1'=> 0,
    'feat_cat2'=> 0,
    'feat_cat3'=> 0,
    'feat_cat4'=> 0,
    'show_posts_list' => 1,
    'show_author' => 1,
    'show_page_comments' => 1,
    'show_media_comments' => 1,
    'ad468' => '<a href='.get_site_url().'><img src='.get_template_directory_uri().'/images/ad468.png /></a>',
    'inline_css' => '',
    'meta_desc' => '',
    'stats_tracker' => '',
    'google_verification' => '',
    'bing_verification' => '',
);
return $options;

}

So im guessing I could remove this function and replace it with my own and alter the values?

Related posts

Leave a Reply

1 comment

  1. The only way you would be able to do this without editing the parent is if they call require() within a function called by a hook such as init, setup_theme, etc. Then you could simply do:

    remove_action( 'hook', 'their_function_name' );
    

    And then you would have to copy/paste the function into your functions.php file, edit it, and then re-add it using the same hook:

    add_action( 'hook', 'your_function_name' );
    

    You may also have to make sure the priority (third argument) is correct on your function to make sure it properly overrides it.