• Resolved noor-e-alam

    (@noor-e-alam)


    I want to make King Composer addon as plugin. So how can i check if King Composer not installed and activated, so that user can see King Composer is required to activate my plugin. Hope you clear what i am trying to say.

    Thanks

    https://ww.wp.xz.cn/plugins/kingcomposer/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author king-theme

    (@kingthemes)

    Hi!

    please use this code bellow to check:

    if(!function_exists(‘is_plugin_active’)){
    include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ );
    }

    if ( is_plugin_active( ‘kingcomposer/kingcomposer.php’ ) ){
    // do your code
    }

    Thread Starter noor-e-alam

    (@noor-e-alam)

    Thanks for the code, but i want to display text ex. “King Composer plugin is required to use this plugin.”

    if King Composer not activated then this text will display in plugins page.

    Thanks

    Plugin Author king-theme

    (@kingthemes)

    Please try this code bellow

    function kc_admin_notice() {
    	$class = 'notice notice-warning';
    	$message = __( 'King Composer plugin is required to use this plugin.', 'text-domain' );
    
    	printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
    }
    if(!function_exists('is_plugin_active')){
    	include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    }
    if ( !is_plugin_active( 'kingcomposer/kingcomposer.php' ) )
    	add_action( 'admin_notices', 'kc_admin_notice' );
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘New addon question!!’ is closed to new replies.