View Full Version : prevent a category from showing in latest articles
kyron2u
02-04-2007, 04:42 PM
How can i disable a particular forum from displaying any articles in it on the latest articles on the home page.
How can i disable a particular forum from displaying any articles in it on the latest articles on the home page.
Not sure I understand? How do you mean "disable a particular forum"?
kyron2u
02-05-2007, 12:38 PM
lets say i have a category on sports. And one of my writers put up a articles, how can i prevent that article or the sports category from showing the article in the latest articles on the home page.
MattUK
03-29-2007, 03:47 PM
I'm interested in this as well. For instance I import some RSS feeds into certain categories. Others are for my articles. I'd only like my articles displayed as latest news and not the imported RSS feeds.
So is it possible to stop certain categories from being displayed on the main page?
chatfan
03-30-2007, 12:07 AM
This is something I would like to have as well, including the option of taking out author from the featured author block.
shketuljko
03-30-2007, 02:56 PM
It is rather simple, with only two steps involved ;) Here's HOW-TO on removing specific category or categories from displaying in LATEST NEWS on home page.
1. In class file
VIVVO_ROOT/Class/Article.class.php, locate this function (around 778 line)
function add_filter($type, $condition = '', $condition2 = '')
try to find
case 'a.rss_feed':
$this->add_where('a.rss_feed = \'' . $condition . '\'');
break;
add this code after "break;":
case 'not_in_category':
$this->add_where('a.category_id NOT IN (' . $condition . ')');
break;
In method (around 856 line)
function &search($params, $order='', $direction = 'ascending', $limit =0, $offset =0)
try to find
if (isset($params['rss_feed'])){
$this->add_filter('rss_feed' , $params['rss_feed']);
}
after that add this code:
if (isset($params['not_in_category'])){
$this->add_filter('not_in_category',$params['not_in_category']);
}
2. In VIVVO_ROOT/index.php (around 563 line) try to find this line
$article_list->search(array('a.status' => 1, 'a.created' => $cur_date, 'a.featured_news'=> '0' ), 'order_desc', 'descending', $latest_news_number, 0);
replace this line with
$article_list->search(array('not_in_category' => '1,2,3','a.status' => 1, 'a.created' => $cur_date, 'a.featured_news'=> '0' ), 'order_desc', 'descending', $latest_news_number, 0);
THIS ARGUMENT IN ARRAY IS VERY IMPORTANT
'not_in_category' => '1,2,3'
Replace 1,2,3 with respective number (ID) of category you wish to exclude from Latest News.
This applies to 3.5 version only.
chatfan
07-29-2007, 02:30 PM
THIS ARGUMENT IN ARRAY IS VERY IMPORTANT
Quote:
'not_in_category' => '1,2,3'
Can you change this value around turning it into a "in_category" with over 50 categories to exclude that seems like a simpler option.
Read the instructions from utvara and simply added th 'a.cid" => X where X is the number of the news category I want to show only. Turning it into this:
$article_list->search(array('a.status' => 1, 'a.cid' => X, 'a.created' => $cur_date, 'a.featured_news'=> '0' ), 'order_desc', 'descending', $latest_news_number, 0);
So no need to change the Class file, just eddit the index.php and add the 'a.cid' => X, if you want just one category in the latest news on your frontpage.
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.