WordPress.org

Ready to get started?Download WordPress

Forums

Stresslimit Custom Content Types
[resolved] How to check if plugin is activated. (4 posts)

  1. This plugin is awesome. All I have to do is put the following line of code in my functions.php:

    sld_register_post_type( 'client' );

    However, if this line of code is in my functions.php and the plugin is not activated, then I get the white blank screen.

    I know that all I have to do is say something like <?php if plugin is active.. do this.

    But I have no idea how to convert this english statement into PHP. Anybody?

    http://wordpress.org/extend/plugins/sld-custom-content-and-taxonomies/

  2. CatherineWinters
    Member
    Posted 2 years ago #

  3. Here's the function you're looking for: is_plugin_active()

    Haven't used it much myself. Wanna take a stab at it and let me know if you still need a hand?

  4. Whoo Hoo.. Got it.. I was looking at that page and couldn't figure it out, buy you ladies showed me that I was trying hard enough.

    So for anyone wanting the full code snippets, this is what goes in your functions.php file:

    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    
    if (is_plugin_active('sld-custom-content-and-taxonomies/sld-custom-content-and-taxonomies.php')) {
        sld_register_post_type( 'client' );
     }

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic