You can include/require all *.php files recursively using following function.
foreach(glob(get_template_directory() . "/*.php") as $file){
require $file;
}
Alternatively You can use following function as-well.
$Directory = new RecursiveDirectoryIterator(get_template_directory().'functions/');
$Iterator = new RecursiveIteratorIterator($Directory);
$Regex = new RegexIterator($Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
foreach($Regex as $yourfiles) {
include $yourfiles->getPathname();
}
P.S Got the solution From Here.
Related Posts:
- Ajax call always returns 0
- plugins_url vs plugin_dir_url
- Get list of years when posts have been published
- Where and how to put inline js in pages
- Is it possible to remove the “standard” post format?
- Do WordPress’ cron’s clean up expired transients?
- How to add first name & last name to default registration form?
- Masking logout URL
- How can I programmatically create “child” pages on theme activation?
- Warning/Notice about functions.php
- Is checking whether the blog is installed necessary?
- Overriding methods in a child theme
- WP disobeys disabling of the posts revision feature
- How do I deactivate a plugin for some roles
- img width and height attributes being set by get_the_post_thumbnail
- How to properly add NPM packages and integrate them in WordPress?
- wp_enqueue_script add integrity parameter
- Passing arguments to my function with do_action and add_action is not working
- How to find the source of the text for wordpress website? I want to change that text
- change in form-checkout.php by using code in functions.php
- List child pages of specific page using shortcode
- when I fetch data from remote mysql database in wordpress built in wordpress function is not working?
- Custom function in My Custom Functions returning 403
- Register vendor JS/CSS only on pages that require them?
- Adding HTML to the end of every post with the Block Editor
- Can I hide certain upload folders in media library [duplicate]
- Function issue with Walker_Nav_Menu [duplicate]
- functions.php How to add css/js depending on Template Name?
- wp_nav_menu, walker class, categories as classes of li
- Calling a Function in Functions.php from an external PHP script
- Why is my page feed returning empty content?
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- Including a specific Javascript Script in a template. Is my code correct?
- Custom shortcodes not inserting into visual composer columns
- Redirect to another page if the user is logged in when pressing again the login button on menu bar
- Adding a colorbutton in tinymce dialog with current api
- Post meta not updating
- Accessing two databases wordpress
- Add a jQuery Function
- append to existing parent theme function
- Get category URL for current post
- How can I get the post id from within functions.php
- Check if Page Slug Exists, then display that Page’s Title
- Why doesn’t is_page(id) work in functions.php?
- I have problems with loading javascripts
- Enqueuing latest version of jQuery into a child theme returns a blank screen
- Function to alphabetically sort custom post types creating duplicates
- How do I change a parent theme’s function through the child theme?
- Dropline menus — seperators between children only?
- Echoing function into WordPress NextGen gallery
- does wp function the_content(); accept another tag inside
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- Redirect to other page if login
- Prevent loading of functions
- 404 when enqueue_script using plugin_url
- WP Customizer API loaded into functions.php
- Get term slug by term id and then explode it
- Shortcode question
- call_user_func_array() expects parameter 1 to be a valid callback, function
- How to use get_posts() function in functions.php
- the_widget() inside functions.php
- loginout function customization
- How Can I add a menu to the theme from withen the function.php file
- define css class in functions.php
- Adding tables to the WordPress Editor
- Add Login and logout buttons to top menu bar
- implementing a centralized content “show-do-not-show” toggle?
- How to hide content on mobile in the functions.php file – woocommerce
- Load templates, pass arguments, and render output from functions.php
- How to load a css file depending on the current role
- WordPress Lite/Light
- How to add HTML into error message
- Add a word after the post url if it is within a specific category
- Probleme shortcode with list author
- Is_Page doesnt detect my page
- Security when outputing wp_oembed_get code
- Show image after X para – center aligned
- Problems adding a new field to product in cart
- Function for Sticky Post on Categories causes issues with 404 behavior
- Unable to declare AOS library in functions
- Get value of pre-populated Gravity forms field as variable in my function
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Graphic before title – Specific Category
- Edit meta fields from within template
- What to do to have access to WordPress functions
- Adding a meta box fields to child theme options page
- Changing the color of post title [closed]
- How to programmatically GET (to know) which Sidebar (or) which Menu is being used on Different Pages?
- Create html from function
- wp_list_pages change of children and anchor of parent
- Admin Panel errors because of functions.php
- WordPress not performing direct update
- Using Output from one Function and calling it into another
- How to add a class and title attribute to the link generated by next/previous post
- “Headers already sent” while trying to add a CSS file to my login page?
- Remove theme, change theme button and WP version on “Right Now” admin dashboard?
- Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in ….functions.php on line 73
- Get all users from role and add to dropdown (select) – wordpress, javascript
- WordPress enque the same script causes the setInterval not to work