functions.php
will load automatically for every page load, but you could certainly move most of the content of your current functions.php
to other files and use functions.php
itself as a primarily a kind of switch.
Caveat: You may have to hook some of your switching functions to get access to certain data. For example, functions.php
executes before the main query (which is why the pre_get_post
hook works if called from there) so things dependent on the main query won’t be set correctly in functions.php
.
Related Posts:
- WordPress function like is_category for subcategory? is_subcategory?
- deregister scripts on certain page
- is_front_page not working in functions.php
- disable comments if array exists
- Problem using is_single() to enqueue script from functions.php
- Conditional tag is_page with a custom post type
- Limit posts only on home page – ideally in functions.php
- Enqueue scripts not working with if is page conditional tag in functions.php
- Conditional read more adjustment
- How add various functions within 1 conditional?
- Conditional Gravity Forms filter in WordPress Multisite
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- is_page() or is_single not working
- functions.php and conditional tags
- issue with if/elseif in_array inside foreach loop display only one post
- Set “woocommerce_is_purchasable” to false for specific “$product->is_stock_status”
- Function to echo (or display?) wordpress tags in the head section
- is_home() not working in functions.php file
- If is_single in functions.php
- Enqueue script if not page template
- is_product_category(‘Services’) not working
- method to fetch entire tag list on archive.php
- Adding an IF ELSE to a function
- how to display featured image for single post for a specific category
- Load CSS conditional on custom field is present
- admin-ajax.php nulls all php variables
- restrict access to specific urls on a specific period of time
- Change conditional tag in wordpress without editing the core files
- wp_enqueue_scripts called twice?
- How can i hide content if not friend in Buddypress? [closed]
- PHP Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false
- Advantages and disadvantages of using automatic-feed-links
- How to change the markup WordPress inserts for post images
- Limit the length of the Author Profile Biographical Text
- Convert hyphen to underscore in permalinks
- wp_mail not running inside Cron
- Remove product description from product archive page
- Logging in redirects to correct page but shows logged out content until forced refresh
- How can I stop a function from encoding an entity?
- Increment price for Woocommerce Minicart [closed]
- Change woocommerce products weight varation based its product category or tags? [closed]
- Function to “Press Update Button” on all posts
- Change WP attachment name to postid during upload only for post type
- Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
- Check if row exists before inserting
- Missing argument 2 for a custom function widgets_init
- Removing the main link to Jetpack from the menu
- Defining a global array in functions.php?
- Get the 5 lastest Featured Posts from a category
- Set quantity of woocommerce product on page visit [closed]
- get_post_type() in in_array doesn’t work for some reason
- Is it possible to change any of the HTML/URL returned from the_category()
- How to remove set_post_thumbnail_size() in child themes?
- Activate small php condition at footer over page template
- Fatal error: Cannot redeclare when switching themes
- How to load jQuery in the footer – nothing works for me
- Specify number of posts for sub-category page
- how to en-queue jQuery to load before the tag
- comments_popup_link without echo?
- Can’t filter wp_get_attachment_link
- Impossible to call wordpress function inside an include?
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Remove a category from a post when saving a new post
- Want to dequeue all the CSS and JS from /wp-content/uploads/xyz-folder
- Scripts not loading when using the wp_enqueue_scripts action
- is there a way to remove featured image from blog page and single page
- Include the post type before the title of search results
- Adding additional roles on registration
- add referrer to woo
- overwrite code snippet from parent to child theme
- Get Attachment Category Name
- Problem with custom function when I go back with the browser
- Show Featured Image in else statement
- Function to check if custom page is used by page?
- Simplest Way to Build Custom Archives Page?
- Filter for replacing the WP_query object for a given category
- Custom user role still showing up after deletion, ideas?
- How to Display WooCommerce Product Price in WooCommerce Archive
- Bizarre Child Menu Issue on WP Site
- get variables data from functions.php to template wordpress (without global variables)
- how to increase connection time
- Shortcode to insert default text and change one word throughout it?
- Its my first time trying to create a website , I got an error Please help
- Add schema to Search result page’s body. Tried using is_search
- Drop down list code for sidebar
- Shortcode Initialization in a Custom Theme
- Hide disclaimer from summary excerpts
- Load scripts into an AJAX div
- restrict uploaded image size and fixed image display size
- Restricted images only for logged user. (hidden url)
- Open image size links in a page instead of direct image link
- Override parent theme function that is not hooked or in the functions.php file
- Syling Custom Fields echo’s from from functions.php
- Function to get thumbnail img source
- WP Custom Comment Callback Not Responding
- Do something when user creates post (that’s pending)
- Add product to cart from functions.php
- How I can show short content with short tag
- How to add more than one menu for logged in members?