If it is a custom theme for your site then there would no great speed or security improvements by moving functions.
On the other hand if you want to distribute the theme then I recommend having only the minimum php in the page templates files and having the rest of the functions organized in different files. I like the basic theme set up files of the theme to be in the functions.php and the rest in separate organized files. _s does a good job of this. The reason for moving the functions away from the templates files is that it makes it easier to customize and manage. If you need to duplicate a template then you do not end up duplicating functionality.
I would even place the non-presentational functions in a plugin for easy deactivation and management. See this answer for more information.
Related Posts:
- When to check if a function exists
- Maximum lifetime for nonce
- Create a free scripts and styles template within a plugin
- How can I turn a custom wordpress page into a product page?
- How to modify files inside wp-includes directory in wordpress
- Customise Grouped Product display in Woocommerce with custom column
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- Add function to Dokan ajax class
- Template file structure , wordpress hook for altering the template
- Dynamic banner for use on external sites
- How to include PHP files in plugins the correct way
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- Is it ever okay to include inline CSS in plugins?
- Why does WordPress add 0 (zero) to an Ajax response?
- Passing arguments to a admin menu page callback?
- How can I configure Docker for developing and deploying a custom theme?
- Is the new WordPress 3.1 admin bar pluggable and how can I extend it?
- Understanding WordPress functions’ naming conventions
- Using filters and actions for plugin API?
- Allowing for multiple template views on the Gallery Settings page when using the Visual Editor
- Using Primary Color in Plugin Block
- How can I change the frequency of a scheduled event?
- Determine which theme location a wp_get_nav_menu_items is for
- How to fix a theme with page.php Default Template that accidentally deleted?
- Checking for existence of a page by title?
- How to use wp_set_password in a plugin?
- Check if I am in the Admin Panel (wp-admin)?
- How to check active theme is parent or child wordpress
- WP_LOCALIZE_SCRIPT doesn’t work
- Does add_filter work outside functions.php
- What function to hook for changes made in status and visibility of a post
- Delete a specific item menu when I deactivate my plugin
- Is there a way to loop through a shortcode datasource to create a table?
- how to use preg_replace for wordpress video?
- Are we allowed to use the Allman (BSD) indent style when coding WordPress plugins and themes?
- WordPress not working on localhost
- Enqueue scripts in footer
- Retrieve contents/page names of various pages for use in a plugin
- Can wp_list_comments output into variable?
- is user logged in not working
- get_current_screen() return null
- ServerSideRender and Media Object: attributes passing image data object to php renderer even though it’s not set
- Override class inside $atts shortcode_atts in WordPress
- How to use a hook to override an update_post_meta call in a plugin?
- Add code inside specific wordpress standard function
- Edit Yoast SEO breadcrumbs output [closed]
- correct way to call javascript into hook function
- How to change the hover content of a specific menu item on WordPress?
- How can we display product price $104 on the cart while the credit card payment method is checked?
- How to add user details to different tables immediately after user registration
- Is there documentation reference for forms in menu and setting pages?
- Plugin templates vs Parent Theme
- Enqueue script globally
- Custom entity search and display
- wp_get_theme Warning: Illegal offset type
- Plugin: database creation
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- Apply styles to blockquote element with the WYSIWYG editor
- Logout after clicking URL link results in “headers already sent” error
- Why aren’t some plugin styles loading when I load a template?
- Plugin custom post template; without overriding all posts
- How to output functions from plugin inside theme
- Best way to distribute templates and code accross multiple wordpress sites?
- How to replace settings in WordPress plugin from a theme
- Remove Permalink Meta Box not working?
- Setting a post’s category
- Modify code for functions.php with specific twitter user url and hashtags
- Extract Information from post content (using regex?)
- can’t access some WordPress function from my plugin
- Serial Number from custom table not appear in woocommerce_email_before_order_table action
- Can someone explain what’s the use of parse request function in WordPress?
- Add default value from selection
- Override category archive page title (not the head title)
- Metabox types list
- Where to save Gutenberg plugin data?
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- Why would one specify multiple arguments when using get_previous_posts_link() which takes only one parameter?
- I cant add is_admin control to plugin
- Rate limiting ajax requests in WordPress
- How to prevent users from deleting their accounts?
- Hiding class namespace from plugin’s extensions
- Set widget icon in Customizer?
- Add new header/footer on landing page with plugin
- Create Customization panel for Plugins not for theme
- WordPress function with attribute pass to template
- PHP includes with AJAX actions
- Use a page as a template for a custom post type
- Function not working on any file other than the main plugin file
- Custom Post Type and Functions
- Managing Custom Designed Content
- How can I see a varibles value when my plugin runs?
- Best practice: What belongs in theme and what in plugin for large eCommerce website
- Adding Meta box to thrid-party plugin
- How to check during “pre_get_posts” if WP performing default query for specific custom template?
- Is Explicit Versioning a better alternative to Semantic Versioning for wordpress?
- WP Custom tables query
- get_term_by() returning null on plugin
- WP Job Manager – Show recent jobs as cards
- Developing an IP lookup function using an API
- Custom Gutenberg Block ‘Stylized List’ – Incorrect Rendering and Looping of List Items