The active theme’s functions.php is included on the backend because a theme can be configurable from the backend.
If your theme depends on the functions of a plug-in being available, then you must either make sure the plug-in is always available or make your theme robust enough to handle situations where it isn’t.
You could put all of your theme’s functions that need the plug-in’s functions into a separate php file that is only included when the plug-in is active. This would make it easier for you to deactivate the plug-in for short periods while you make other updates.
So in your theme’s functions.php you could add:
if (function_exists('plugin-function-name'))
{
include 'path/to/functions-that-need-the-plugin.php';
}
Then you only have check if function exists once, and the theme and backend will still function when the plugin is not available.
Related Posts:
- Disable plugin / plugin action via theme
- Shared functionality in plugins and themes
- Need to create a Theme demo site that features multiple themes
- Declare a function before plugin does on the theme functions.php file
- Override the core function locate_template
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- All sites themes functions.php have been changed
- Overwrite category head title
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Removing the custom_image_header from wp_head
- What is the most efficient way of adding additional functionaliy for admin only
- Hide Plugin Custom Post Type Menu Link
- Securing langugae folder
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- How to Call Function From Separate WordPress Install on Same Server?
- pluggable function in theme, to be overridden by plugin
- Can’t get custom user meta to show in header
- Why nested REPLY not working in WP Comments?
- Theme my Login plugin, how to update fields
- Plugin Handle URL With Custom Theme
- Globally register styles but enqueue them selectively
- Edit Yoast SEO breadcrumbs output [closed]
- How to read individual user’s directory and display content to that specific user?
- Adding Shortcode to Text Widget
- Date calculations from 2 custom fields
- Guidelines / restrictions about advertising /donate begging unside wordpress plugins or themes
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Admin Theme customization
- Custom random quote widget breaks when used in multiple sidebars
- Hooking in to replace the Sidebar/Widget areas
- WSOD after upgrading to 3.1
- Using a function to change favorites listing
- Display post lists in 2nd paragraph
- How to debug error message: Cannot modify header information
- Using a post-signup hook to get user details
- How to enable specific plugin only based around shop manager role?
- How to change constants in WordPress wp-config.php programmatically?
- Restrict media upload size by format
- How to use a class from another plugin
- Override Plugin Script Fucnction in WordPress
- How to display custom sidebar in wordpress 5.5.2
- Check for security updates
- Calling plugin function inside custom plugin for onclick event
- Show function to super admin
- (FES EDD) New vendor submission page is blank
- There is any way to remove post-format filter? [closed]
- Plugin-generated pages use Not Found or Pages Archive templates?
- creating html reusable blocks via shortcodes
- Is there any kind of theme on WordPress to sell my own movies?
- Create custom registration form for WordPress Multisite
- get current date + 90 days and checking every day
- Child Pages Short Code plug-in and hover capabilities?
- Adding a new field to the address field type in gravity forms
- Classified ad website : which solutions to use? [closed]
- Replacing a plugin function with a custom renamed function doesn’t work
- How to create an input field, and base the output on spreadsheet data? [closed]
- Linux Permissions and Ownership for WordPress
- posts comments goes to trash
- Facebook Messager Plugin
- WordPress site periodically goes down
- Masonry images not working
- Nested shortcode functions accessing variable
- Advanced Custom Field DatePicker [closed]
- Calling an attribute from a plugin shortcode
- How to call WordPress function other files
- Homemade plugin while using Themify Ultra
- Customize permalink wordpress category id
- Conditional attributes and logic per product category
- Disqus deleted comments are syncing with wordpress but active comments do not
- Admin style for just one plugin in dashboard
- Why namespaces are rarely used in WordPress plugins?
- What will happen if i deactivate my visual composer plug in? [closed]
- Finding the URL to be used to check if plugin is installed with a theme
- Theme/Plugin installation through url on button click
- (Big issue) Blog is Getting Down Each day.. what should i do.?
- Custom wordpress Theme and Plugin repository
- WP Query. Is there a maximum size?
- How to remove custom post type and add category and post name
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- Grab WordPress Salt Data From URL
- How to require users to login when not logged in
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- WordPress get_avatar function not correct working
- Error when using plugin QuickCache with plugin Mobile Smart ? [closed]
- WordPress metaboxes – textfield suggestion automatically populated
- bbPress plugin: forum lists not showing in correct order? [closed]
- Which file of wordpress manage plugins functionalities?
- How to create an option page for this simple plugin
- Does WP delete deprecated plugin/theme files on plugin/theme upgrade?
- Difference and examples of esc_attr__() and esc_attr_e()
- How to set Noindex to all wordpress pages in a catergory?
- Is there any hook for theme activation ? or something similar?
- How to use get_template part in the plugin?
- How can I use get header from within my plugin?
- Redirect to another page using contact form 7? [closed]