Organize your code by its purpose: If it creates output on the front end and requires changes in your theme’s style sheet – it belongs to the theme. You don’t have to put everything into the functions.php, split he code into several files if it helps.
For example like this:
// extra functions just for nav menus
locate_template( 'php/functions.nav-menu.php', TRUE, TRUE );
If it should survive a theme switch (Custom post types, shortcodes) or is not related to the theme at all – it belongs to a plugin.
The pure number of plugins is irrelevant: 200 fast plugins are better than one slow plugin.
Template files are for views – they should not contain function definitions that are hard to find there. And shortcodes are a special API, not places.
Related Posts:
- How to export comments in WordPress?
- How can I call a function from one plugin within another plugin?
- Gutenberg disallow certain custom blocks but keep all core blocks?
- Remote upload file to server B
- Publish author posts only with editor approval?
- Using functions from a plugin in your theme
- Keep one user logged for a year?
- Customizing subject in comment notification e-mails
- WP showing “warning: call_user_func_array()”, What to do?
- Declare a function before plugin does on the theme functions.php file
- Generate Advanced Custom Fields box in custom admin menu page
- How to turn off email you receive when registered?
- Removing user contact methods works from functions.php but not from a plugin
- Use functionality of 2 wordpress plugins
- What’s the point of using WordPress’s built in admin-ajax.php?
- How can i change an image’s author?
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Showing Co-Authors on post page
- jQuery Plugin to use WordPress functions in AJAX request
- Using plugin functionality in external php script not working
- Debugging Technique Question re: functions.php
- Override plugin with functions.php
- The Point of Using apply_filters()
- How to get post URL in the_content filter?
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- How to include code into functions.php file via a plugin
- May i Use ShortCode in Template?
- Missing argument 3 for wp_register_sidebar_widget()
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- Shortcode button dosent work for all posts. Work for first post only
- Is there a way I can find wordpress posts that don’t contain a word?
- Prevent shortcode from being wrapped in tags
- Inserting HTML tag with ACF into shortcode
- How to Display a Plugin function (content) on frontpage using index.php
- Theme my Login plugin, how to update fields
- Calling plugin function inside custom plugin for onclick event
- Show function to super admin
- All sites themes functions.php have been changed
- Customize permalink wordpress category id
- Grab WordPress Salt Data From URL
- Plugin is a widget, but I want to call it in the head, can I?
- Basics of changing plugin output
- Why can’t I call a (member) function from within a foreach?
- Are there action hooks for comments?
- Help with WP Business Directory Manager Plugin?
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- Shortcode Attributes to Return different $_POST
- Plugin onclick button activate other plugin
- Loading a plugin’s js file from functions.php
- Activate and deactivate plugin automatically
- dynamic name of the style for wp_enqueue_style
- WordPress function to add text warning on every pages [closed]
- How to access OOP plugin function inside themes or other plugin
- Different registration form for different roles
- Call javascript functions from each page
- Add_image_size not generating correct size
- Elementor Pro display featured image on section -> style -> image using shortcode
- How can i call a functions.php function, from inside my plugin class?
- How to make WooCommerce payment method field optional?
- Create a pdf from the entries in DB
- RSS feeds for specific topics
- WordPress Custom Hook with Class method
- Allow a particular user to access a particular plugin?
- how to define a html folder to make it work with WordPress commands
- add a hook of Woocommerce to a plugin but it only shows and doesn’t function properly
- Overriding a function in a WordPress plugin
- ACF Fields are not showing up on Homepage
- Get Shortcode output to database for static post_content
- Use buddypress function outside of plugin
- Securing langugae folder
- WPML – Hook when language is switched (change user language)
- Call function with button and return response
- Use action, filter, or hook to append HTML to WordPress plugin function
- Return function results within shortcode
- Save Post Permalink In .txt File
- Why is WP template_include overwritting all templates rather than specified page?
- How to Call Function From Separate WordPress Install on Same Server?
- How to echo a plugin’s function into a template?
- Find all strings between an enclosing shortcode
- Wp Ecommerce Reposition Product Page Product Thumbnail Image
- It possible to implement an adhoc php web application with wordpress?
- How to Overwrite validate_plugin function
- making a glossary with wordpress
- date function not correctly returning date
- Disable plugin function
- Trying to output a “Most visited blogs” list in wordpress multisite
- Access to wordpress method inside of classes
- How to prevent page load on form submission
- wordpress Search function is not working
- Send email notification when meet the condition
- WordPress: code structure
- PHP Creating a formula from mysql db values and db stored math operator
- How to disable plugin capability : “create new category”
- filter just a portion of plugin function
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- stop resize button for wordpress media
- Mixed results with is_page() WordPress function, when using $this, or self