Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the mingle plugin and the mingle-forum plugin.

I want to show a certain part on my site only if those two plugins are active. How can I solve this?

<?php if ( is_plugin_active('mingle-forum') ) { ?>
                    <div id="login"><?php include (TEMPLATEPATH . '/inc/userlogin.php' ); ?></div>
                <?php } ?>

This throws a php error. Call to undefined function is_plugin_active

Any idea what I'm doing wrong?

update:

<?php if ( plugin_active('plugin-directory/mingle-forum/wpf-main.php') ) { ?>
                    <div id="login"><?php include (TEMPLATEPATH . '/inc/userlogin.php' ); ?></div>
                <?php } ?>
share|improve this question
    
Where (what file or hook) do you use this function? –  JohnnyPea Apr 21 '11 at 12:51

1 Answer 1

up vote 1 down vote accepted

This function exists in wp-admin/includes/plugin.php so I'm assuming it doesn't get included by the theme.

You can either require it, or just create your own version of it - see here: http://wordpress.org/support/topic/is_plugin_active

share|improve this answer
    
thank you, i might have found a solution but I still can't get it working. The function plugin_active is set in my functions.php file and doesn't through an error. However my div.login does NEVER show up, doesn't matter if the plugin is active or not. Maybe I'm checking for the wrong path? Any idea what I could do wrong here? –  mathiregister Apr 22 '11 at 7:41
    
found the solution. "plugin-directory" of course has to be the name of the directory where the actual plugin file is in. I thought "plugin-directory" is the path to the dir where all the plugin files are in. –  mathiregister Apr 22 '11 at 7:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.