• Resolved eagerbob

    (@eagerbob)


    Hello,

    I am working on a Understrap childtheme.

    I want to add some functions, and instead of adding them to the functions.php I want to do that in a separate file that is included from the /inc directory, just like the parent theme does.

    If I try to include my file from the functions file in my childtheme with require_once like so:

    require_once(get_stylesheet_directory() . ‘/inc-my-algo-php’);

    I get a critical error. I guess this is because this replaces the parent theme includes?

    My question: can I add my own functions by adding them to the /inc directory in my childtheme?

    Thanks!

    • This topic was modified 1 year, 8 months ago by eagerbob.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Can you update your code like this and see if it works:

    require_once get_stylesheet_directory() . '/inc/my-algo.php';

    and ensure the the my-algo.php file is sitting in your child theme’s /inc/ folder?

    Thread Starter eagerbob

    (@eagerbob)

    Yes, that’s it. No parenthesis.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘including from childtheme functions’ is closed to new replies.