• Resolved Emile

    (@emile-de-bruijn)


    Great API, bit I can’t get it to work with my own plugin. What am I doing wrong? (if I echo the $department it is showing the right value that should make $go true, but the theme is not switched)

    // Switch to Twenty Eleven theme if the visitor is from a certain department
    Conditional_Themes_Manager::register( 'twentyeleven', function() {
    
    	// Get info
    	$user       = wp_get_current_user();
    	$user_id    = $user->ID;
    	$department = get_cimyFieldValue($user_id,"AFDELING");
    
    	if ($department == "Department X") {
    		$go = true;
    	} else {
    		$go = false;
    	}
    
    	return (bool) $go;
    
    } );</blockquote>

    https://wordpress.org/plugins/wp-conditional-themes/

Viewing 1 replies (of 1 total)
  • Plugin Author Nashwan D

    (@alex-ye)

    hmm.. the code looks good! .. make sure to use it in the ‘plugins_loaded’ hook with a priority higher than 99. like the example in the plugin page. 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘What's wrong’ is closed to new replies.