You’ve got an issue with your code. This code will always return true
because you’re passing a string to it.
if ('custom_header_display') { ?>
//my code
} ?>
You can instead use is_plugin_active()
to check if the plugin is activated.
Quoting the example from the Codex page, your code should be like:
<?php
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'plugin-directory/plugin-file.php' ) ) {
// include your file.
}
Related Posts:
- Why isn’t is_page working when I put it in the functions.php file?
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Can shortcodes contain conditional statements? Even without them my shortcode renders blank page
- If function exists, and array is met, echo function?
- Conditions for Users and Visitors
- Conditional statement not working in function
- Conditional function for excluding first image from content, not working
- Using Switch Statement to Change Image According to Last Digit of Topic ID
- restrict access to specific urls on a specific period of time
- Using conditionals, maybe from a DB, to register & enqueue files, for varying pages, in functions.php
- How to use the do_action () with parameter
- TinyMCE custom styles remove class when switching styles
- Extending the site search to include a single custom field
- Notify users whenever a new post is published based on their preference
- syntax for remove_filter in parent theme with class
- Remove Header and Footer in iframe
- How to Acheive the custom woocommerce category template
- Can I remove the Rich Text box editor for a specific post?
- Formatting post content to exclude gallery
- Why do I get undefined function export_wp()?
- Redirect if not logged in?
- How to set global variables in template page?
- Programmatically set page template based on page ID
- Setting featured image with function, 1 part not working
- Function to show only first instance of shortcode
- Best way to programatically add “rel” attributes to page and post images
- Comments to only be seen by their author
- Remove function or filter
- options.php problem – data not saved
- Filtering posts by category name based on page’s slug
- adding custom classes for tables
- Load parent theme files before child theme functions.php
- CSS for menu item added via functions.php
- Two functions.php files in one theme
- Default Gallery Edit/Template Editable?
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Make parent page only link to first subpage
- Pulling Twitter RSS feed not working as expected (fatal error)
- How to validate this deprecated function
- How can I modify all existing tags while keeping the urls themselves?
- Scripts not appending to element in AJAX call – why?
- Trigger a custom function when option are saved in admin area
- Find a Javascript ID when trying to deregister?
- Functions.php – Cannot Modify Header Information SOLVED [closed]
- Functions For Calling Specific Elements
- How would I add “edit profile” and “blog post” functions to front-end?
- shortcode help require
- How can I add a filter for specific categories on functions.php?
- Custom editor color palette colors are not appearing in the editor
- Set Taxonomy based on post status
- echo custom fields with AJAX
- wp_create_category deprecated?
- How to create a functions.php in child theme? [closed]
- wordpress get_post_meta give only first value
- Using multiple line variable inside a function?
- Determine if, within a post, you are on page 2 or greater – WordPress documentation circular
- Wp-query Order By problem
- WordPress Excerpt – How to remove the first link using functions.php
- Sortable column (by numbers) in admin users
- Compare meta key to current date in pre get post
- Is there a built-in function to duplicate existing posts?
- load CSS only for administrators on backend
- Insert Address fields into function
- Protect get_query_var from manual input in url
- How to remove admin footer text from inside child theme?
- Shortcode to get featured image of specific id post
- Custom attributes to javascript tags
- How to add php within jquery
- Is it possible to put a function somewhere other than the functions.php file?
- Problem with WordPress output text (‘esc_html’ & ‘wp_richedit_pre’)
- wp_enqueue_script() not working
- Get slug of current category in functions.php
- Overwrite text in a complicated filter hook
- removing description tabs – single product page – breaks footer
- Link product attribute value to a URL – woocommerce
- How set a while with a function
- Trying to get the path to my child-theme via my functions.php
- How to add a cron job in my functions.php
- Pagination won’t work on custom page
- Form output outside of container
- Redirect logged user depending on user role if he tries to access home page?
- Shortcode Function – Can’t get anything else to return after running shortcode within shortcode
- Trying to Add a LEFT Sidebar?
- How to pass a variable from a template page to the child theme functions.php
- Home/Static Page View for Visitors pages after that should be restricted
- functions.php filters not applied in AJAX call
- Settings in functions.php used by a plugin
- Mail function not working with user accounts
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- Conditionally write open graph meta property in header
- Adding result from PHP function into an input field
- Using array page name together with page id to deregister script
- Echo a div to header.php from functions.php
- Modifying Page-Links format
- how to handle multiple forloop?
- PHP error in shortcode [closed]
- Working function() doesn’t execute when triggered by WP CRON
- WordPress – Notice: Function wp_enqueue_script was called incorrectly
- post_row_actions filter from parent theme not executing in child theme