I always break my functions.php up into more managable, specific functionality files, for instance, all footer related functions goes into a file called footer-functions.php
and pagination functions goes into a file called pagination-functions.php
. This way, my code stays organised, managable and I don’t kill my functions.php
. This however, is only related to theme specific functions, site specific functions goes into plugins in much more the same type of method
To come back to the point, at the end I include all my smaller specific function files into functions.php
with require_once()
as follow
require_once( 'footer-functions.php' );
require_once( 'pagination-functions.php' );
This is all you need. You should not hook this to any hook or add it in any function, it can have expected behavior which can lead to a broken site
Related Posts:
- Display random categories on the front page (Finding and Editing Theme Functions)
- Issue with get_theme_mod returning a blank value instead of the saved value
- Theme-Config tab in admin Pannel?
- Customizer field value into functions.php variable
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Add Custom Background Properties to Customizer
- unnecessary request call for js and css after calling wp_dequeue_script
- Where do I go to edit this area? [closed]
- Astra theme – cannot set short product description under the product title (product name)
- Header menu aligned right on all pages except for single-post page [closed]
- CSS style and app.js not loading
- Customizer cuistom CSS Priority ordre Issue
- Add multiple custom fields to the general settings page
- How to load scripts/styles specific for a page
- Using classes instead of global functions in functions.php
- Child theme – Overriding ‘require_once’ in functions.php
- How to remove Customize from admin menu bar after WP 4.3
- Is it possible to remove the “standard” post format?
- How to remove row-actions from pages table?
- Hourly Routine Not Firing ( wp_schedule_event() )
- Modify search function in WordPress (TwentyTwelve)
- Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’
- Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?
- How to fix a theme with page.php Default Template that accidentally deleted?
- get_theme_mod(); returns nothing
- Theme Demo in live Site
- How do I change parameters without changing the core
- Customising widget titles/headings in WP 5.8
- Problem with extract() with custom shortcode
- Widgets Section not displaying in theme customizer
- add sidebar area to header of child theme
- Using the child theme functions.php to change the customizer.php on parent theme
- Creating loop within functions.php
- adding custom classes for tables
- Pass Shortcode Attribute to footer Script
- How Can I Expand the WordPress Customize window without any Plugin?
- Set quantity of woocommerce product on page visit [closed]
- Include files in child themes, declare in functions.php
- Automatically wrap multiple images in div
- Ajax not working properly
- functions.php mistakenly deleted
- Echo tags used to describe the theme
- How to load jQuery in the footer – nothing works for me
- Calling a Function in Functions.php from an external PHP script
- How can I remove the main description text box in a Woocommerce product editor page? I only use the “Product short description” text box [closed]
- Best practices regarding the creation of custom widgets?
- How to remove style attribute in WordPress RSS output?
- Customizer: active_callback and sanitize_callback incompatibility?
- Customizer: save setting/control content to post/page
- Impossible to call wordpress function inside an include?
- different style sheet for just one page template
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Turn get_posts as string into an array for use in theme admin options
- Can’t switch to a child theme using filters template, option_template and option_stylesheet
- login_headertitle is deprecated since version 5.2.0
- Add attribute only to first image of every post via functions.php
- How to edit alternate inactive themes in “Appearance -> Customise” screen?
- Different favicon on different pages
- The_content and Preg_replace in loaded Iframe [closed]
- WP Customizer API loaded into functions.php
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Different methods of adding menu support to custom theme
- Insert a field with PREG_REPLACE – strange behaviour
- How to echo Widget Title in Custom Frontend-Template Box
- how to display a page before the home page
- loginout function customization
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Can’t change theme name
- Function to check if custom page is used by page?
- implementing a centralized content “show-do-not-show” toggle?
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- How to display this meta data (an array) in form of a function (created with a custom write panel)?
- WordPress – using sessions?
- How to remove font awesome from loading in wp theme
- Class parameter in get_avatar args doesn’t get added to output
- Extend WordPress Audio Widget to accept HLS (.m3u8) URLs
- Shortcode to insert default text and change one word throughout it?
- How Can I Concatenate A String With One Of My Custom Field Value Before Saving The Post?
- Change default color scheme in twentyfifteen child theme?
- Shortcode Initialization in a Custom Theme
- WordPress Ajaxifying not working properly
- WordPress function with attribute pass to template
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Help! Need a different logo on my main page from my other pages
- Display page number on custom page title function
- How to replace words in my posts and saved new words
- Getting back a blank WordPress site following functions code edit
- How to pass a variable from a template page to the child theme functions.php
- Add functionality to post editor
- Register a widget area when a theme option has been saved?
- Undo a function that is not (seemingly) hooked to an action?
- Additional Sidebar
- How can I clear the theme mod settings?
- Why does modifying my functions.php file always result in a server error
- Remove snippets of JS from core
- Explode Array from Repeatable Custom Field
- Adding function to function.php error 505 [closed]
- Problem with removing characters “<” – WpAllImport
- multible shortcodes (for differnt values) with one function
- How to automatically load Google Fonts on pages only as they’re used?