2010-09-23 3 views
0

Я использую конкурс популярности для wordpress на собственном веб-сайте.Конкурс популярности в Wordpress только для отслеживания сообщений определенной категории

Возможно ли участие в конкурсе по популярности отслеживать сообщения из определенной категории?

Заранее спасибо.

ответ

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); 
Смежные вопросы