Skip to:
Content
Pages
Categories
Search
Top
Bottom

Exclude Posts in Latest Discussions

  • @process_of_illumination

    Participant

    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • @chandersbs

    Member

    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

    @process_of_illumination

    Participant

    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

    @kawauso

    Member

    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)

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar