Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #184234

    Hi,

    I’m using a child theme to customize my website. All the CSS changes work, but when I change a different file, enfold-functions.php for example, the changes don’t work.

    How can I setup my child theme so I can customize all other files aswell?

    Thanks

    #184954

    Hey Alcadis!

    Please take a look at this topic: https://kriesi.at/support/topic/enfold-child-theme/

    Best regards,
    Josue

    #185108

    Hi Josue,

    Thanks for your reply. I allready found that post and it didn’t mention anything about editing .php files in your child theme.

    I want to load the .php files from the enfold theme first, and then have the changes in my child overrule the regular enfold theme. Is there some code to get this done?

    #185112

    Hi!

    Yes – you can use the after_setup_theme hook – i.e. following function would overwrite the entry_without_sidebar thumbnail size which is define in functions.php.

    
    function avia_after_parent_theme_setup() {
          global $avia_config;
          $avia_config['imgSize']['entry_without_sidebar'] = array('width'=>1030, 'height'=>450 );
    }
    add_action( 'after_setup_theme', 'avia_after_parent_theme_setup', 10);
    

    Regards,
    Peter

    #186083

    Sorry, but I still don’t get it. I should make all my changes in the functions.php of my child-theme like this?

    function avia_after_parent_theme_setup() {
          // My new function goes here
    }
    add_action( 'after_setup_theme', 'avia_after_parent_theme_setup', 10);

    Cause if I change the ‘avia_title’ function from enfold-functions.php, and put this in the functions.php of my child-theme, nothing happens.

    #186781

    Hi!

    You can’t wrap a function around a function. If you want to call a function directly just use following code

    
    add_action( 'after_setup_theme', 'my_function', 10);
    

    and replace “my_function” with your function name.

    Best regards,
    Peter

    #217368

    Sorry to bump this post, but I’ve found other solutions for the things I had to fix so far. But I still don’t really know how I can override functions. I know how the hook works, but I can’t seem to find the right way to override a specific function.

    Now, I want to edit the avia_title function, but ofcourse, I want to do this in my child theme.
    I tried several variations of the code below (using different parts from the original function in enfold-child.php), but nothing seemed to work.

    function avia_after_parent_theme_setup() {
          global $avia_title;
          $defaults 	 = array('heading'		=> 'h1');
    }
    add_action( 'after_setup_theme', 'avia_after_parent_theme_setup', 10);
    #217753

    Hi!

    You can’t overwrite the entire function with a hook. You can either use the “avf_title_args” hook to change certain options/parameters – i.e. like

    
    add_filter('avf_title_args', 'avf_blog_title', 10, 2);
    function avf_blog_title($args, $id) {
    	$args['heading'] = 'h2';
    	return $args;
    }
    

    or (if you want to modify major parts of the function) copy the entire function from functions-enfold.php to your child theme functions.php and it will overwrite the parent theme code/function.

    Best regards,
    Peter

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Child Theme not recognizing enfold-functions.php’ is closed to new replies.