2010-09-23 40 views

回答

0

雖然我沒有在一個小而人氣-大賽的工作,我認爲這應該工作:

/** 
* Define the categories to be tracked 
*/ 
$GLOBALS['pc_track_cats'] = array(1,3,5,8); // alternately, category slugs can be used as well 

/** 
* Check the content each time it is called to see if we're in our target cat 
* if not, remove the popularity-contest filter 
* 
* @param string $the_content 
* @return string 
*/ 
function my_check_pc($the_content) { 
    if (!in_category($GLOBALS['pc_track_cats'])) { 
     remove_filter('the_content', 'akpc_content_pop'); 
    } 
    return $the_content; 
} 
add_filter('the_content', 'my_check_pc', 1); 

/** 
* Replace the popularity contest filter after the content has been run 
* 
* @param string $the_content 
* @return string 
*/ 
function my_replace_pc($the_content) { 
    add_filter('the_content', 'akpc_content_pop'); 
    return $the_content; 
} 
add_filter('the_content', 'my_replace_pc', 9999); 
相關問題