What you’re trying to do is possible.
When including php files, use get_stylesheet_directory()
in child themes and get_template_directory()
in parent themes.
E.g.
require_once( get_stylesheet_directory() . '/inc/myfile.php');
get_stylesheet_directory_uri()
and get_template_directory_uri()
will return URLs. Those functions are useful when enqueuing public assets such as stylesheets and JavaScript.
Also, setting allow_url_include
to Off
in your php.ini will provide better error reporting in these situations (source).
Related Posts:
- How Do I Unhook This Parent Theme Function?
- Issues with title-tag and document_title_parts
- Define custom Page Template without its own .php file
- How to influence the information displayed on widget inside wp-admin
- Implementing DNS Prefetching with WordPress
- syntax for remove_filter in parent theme with class
- Override parent theme function that is not hooked or in the functions.php file
- Remove Page Title from Static Frontpage
- Change parent theme file function in child themes functions.php
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- How to override filter in child theme?
- Gravity Forms field entries into wp_query loop [closed]
- Proper way of using functions in action hook?
- Accepted arguments value in hook functions
- Get current page_id before loop, in functions.php
- Which action hook to use for function?
- Modify a function without editing template
- Problem only while using require_once() within functions.php
- Passing values from a widget to a function within a plugin
- How to filter, restrict and return posts based on custom user meta information
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Replace a menu with widget or a custom template file programmatically
- Override the WordPress core function wp_referer_field
- How to edit the Tags within the image file URLs?
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Can’t properly set the_title add_filter to show short_URL
- How to add_filter html template to middle of content
- (Woocommerce) Order by price when entering specific category
- How to edit classes in body tag?
- Possible to hook into Media Library preview File column and use a custom image?
- Add back in child theme what the parent theme removed with remove_action
- How to have different site identity logos on each page on Astra Theme [closed]
- How to edit/replace Parent functions.php function in Child Theme to add “Walker” class
- Insert Content Before div#main from the functions.php File
- Add Adsense code between job listings – wp job manager plugin
- remove_action not working, even after changing priority [duplicate]
- Changing the text of Upload/Insert on Posts and Pages Screen
- Any adverse effects of adding apply_filters to a function?
- how can I add filter in specfic field in my website?
- Save_post – Warning: Cannot modify header information
- custom error message for empty username and password using authenticate filter not working
- Plugin function in child theme
- Override parent theme function that is not hooked or in the functions.php file
- Force resize for all video content
- Why functions metaboxes is causing White Screen in Admin [closed]
- Remove Actions/Filters added via Anonymous Functions
- Include files in child theme functions file
- Is there a hook or function I can use to display all theme files being used on a current page?
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- Child theme – overriding add_image_size by a child theme [duplicate]
- Set default options for inserting media
- How to hook into the quick edit action?
- Override a class function to include a custom template
- I created a child theme and it doesn’t work for some of the css files
- Child Theme Not Overriding Parent Theme
- WooCommerce add_action hook results in 500 error
- Post Pagination Showing Same Posts Every Page
- how to edit functions.php in a child theme
- WordPress after content Hook & external template part
- str_replace function in theme
- Pass info from functions.php to plugin
- Inserting a functions output after the content
- Handling Body class based on Template
- How to add nav menu items to a specific position within a menu
- Is possible add icon in title posts only in specific tag?
- WordPress Gravatar filter is removing my custom attributes
- Adding an external HTML link to a post thumbnail
- Footer disappears when using the_content ( )
- woocommerce change currency per category [closed]
- Why does re-using this function not work? [closed]
- Make wp_link_pages() suitable for Twitter Bootstrap markup
- Setting a default text for excerpts of a particular category
- Add_filter when value is no variable?
- Adding bootstrap classes to video shortcodes
- How to display the_archive_title() and the_archive_description() – “weird” interaction
- Unable to point the child theme directory even using get_stylesheet_directory()
- get_template_directory_uri() links to child theme not parent
- Functions Filter Question [closed]
- Solution dealing with Child Theme / Parent theme functions
- Hook for altering the content of all wp mails
- Must filter functions receive all arguments passed to them?
- Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy
- Conditional custom menu?
- Get URLs for AJAX Filter Checkboxes WordPress
- Filter works on last selection but no others
- Replace theme function
- Prevent function from triggering on current page
- Assign IDs to headings in ACF using functions.php
- How would I correctly implement a new if statement in a child functions file?
- Redirect specific author posts to another url
- Child Theme not loading multiple stylesheets
- True email confirmation for registration (keeping unvalidated users from user table)
- Best way to add image to recent posts widget?
- Is it possible to change parameters of Parent theme function in the Child theme?
- Functions.php in child theme that loads CSS file breaks website
- Init hook for header send
- How do I add functionality to images?
- Assign new post author IF another user in custom field on post transition
- post_row_actions filter from parent theme not executing in child theme