Powered by Blogger.

How to check if a WordPress site uses Genesis or not



Genesis has some special hooks, in one of my plugin work the client want to have different settings if WordPress use Genesis Framework.

I searched in google and cannot find our API to know if it is Genesis Framework so I write a function to check if WordPress uses the genesis framework.

function waytowp_is_under_genesis_framework(){
    //check if the last node of template path is genesis or not
    $current_theme_path_to_array = explode('/', get_template_directory() );
    if( $current_theme_path_to_array && is_array($current_theme_path_to_array) && count($current_theme_path_to_array) > 0 ){
        if( $current_theme_path_to_array[count($current_theme_path_to_array) - 1] == 'genesis' ){
        return true;
        }
    }
        
    return false;
}


If you have a better way please let me know.

No comments