Info
- 4 posts
- 3 voices
- Started 2 years ago by Process_of_Illumination
- Latest reply from Adam Harley
- This topic is not resolved
Exclude Posts in Latest Discussions
-
- Posted 2 years ago #
Hello,
how would it be possible to exclude posts from a certain forum in the "latest discussions" section?
Like in this forum in your "latest discussions" you get posts from every forum except for "pimp your press".
I did use the search, but i only found how to hide the category, and not how to prevent "lates discussions" from collecting posts from a certain category. Probably my English isnt good anough and miss the right search keyword.
Thanks for your advices... and patience.
the Process
-
- Posted 2 years ago #
I'm using this code:
<?php if ( $topics ) : foreach ( $topics as $topic ) : ?> <?php if( $topic->forum_id != 29 && $topic->forum_id != 30 && $topic->forum_id != 18 && $topic->forum_id != 15 && $topic->forum_id != 4 ) { //exclude forums here ?> <tr<?php topic_class(); ?>>If you're using the Kakumei theme, replace this with that:
<?php if ( $topics ) : foreach ( $topics as $topic ) : ?> <tr<?php topic_class(); ?>>Just change the id's
-
- Posted 2 years ago #
Hi Chandersbs,
i am sorry i didnt get what i should do: should i edit only this part
{ //exclude forums here ?>
and fill it with the id of the forum i want to exclude?
Or should i change the ids in the following line? I only have 1 forum to exclude, and its "position" is 4, does that mean that its id is 4 as well?
<?php if( $topic->forum_id != 29 && $topic->forum_id != 30 && $topic->forum_id != 18 && $topic->forum_id != 15 && $topic->forum_id != 4 )
Thanks!
The Process
-
- Posted 2 years ago #
This might be a cleaner solution
<?php switch ( $topic->forum_id ) { // Ignore these forums case 29: case 30: case 18: case 15: case 4: continue 2; } ?>or for including only certain forums
switch ( $topic->forum_id ) { // Include only these forums case 29: case 30: case 18: case 15: case 4: break; default: continue 2; } ?>but using that if statement, you need to change the line
<?php if( $topic->forum_id != 29 && $topic->forum_id != 30 && $topic->forum_id != 18 && $topic->forum_id != 15 && $topic->forum_id != 4 )
and you can find the forum ID from looking at its Edit URL in the admin panel (under Forums) -
You must log in to post.