Skip to:
Content
Pages
Categories
Search
Top
Bottom

Tabling the categories & non-categories on it's own.


  • gerikg
    Member

    @gerikg

    This is going to be complex to explain but I’m going to try.

    This is from front-page.php

    <?php if ( bb_forums() ) : ?>
    <h2><?php _e('Forums'); ?></h2>
    <table id="forumlist">

    <tr>
    <th><?php _e('Main Theme'); ?></th>
    <th><?php _e('Topics'); ?></th>
    <th><?php _e('Posts'); ?></th>
    </tr>
    <?php while ( bb_forum() ) : ?>
    <?php if (bb_get_forum_is_category()) : ?>
    <tr<?php bb_forum_class('bb-category'); ?>>
    <td colspan="3"><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> – ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
    </tr>
    <?php continue; endif; ?>
    <tr<?php bb_forum_class(); ?>>
    <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> – ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
    <td class="num"><?php forum_topics(); ?></td>
    <td class="num"><?php forum_posts(); ?></td>
    </tr>
    <?php endwhile; ?>
    </table>
    <?php endif; // bb_forums() ?>

    This basic says the table headings are Main Theme, Topics, and Post. I wanted each category to be in it’s own table.

    So if you have a category, let’s say category “Welcome” and a child forum “Welcome to Our Site” and a category “Support” and child forum “PHP Help” it will display: (the dashes are spaces, ignore them)

    -Main Theme


    Topic–Post

    -Welcome


    —Welcome to Our Site


    0


    0

    -Support


    —PHP Help



    0


    0

    but I wanted:

    –Welcome


    Topic–Post

    —Welcome to Our Site


    0


    0

    -Support


    Topic–Post

    —PHP Help



    0


    0

    SO I thought it was easy so I did this:

    <?php if ( bb_forums() ) : ?>
    <h2><?php _e('Forums'); ?></h2>

    <?php while ( bb_forum() ) : ?>
    <?php if (bb_get_forum_is_category()) : ?>
    <table id="forumlist">
    <tr<?php bb_forum_class('bb-category'); ?>>
    <th><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><br /><?php forum_description( array( 'before' => '<small>', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?> <th><?php _e('Topics'); ?></th>
    <th><?php _e('Posts'); ?></th></td>
    </tr>
    <?php continue; endif; ?>
    <tr<?php bb_forum_class(); ?>>
    <td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><br /><?php forum_description( array( 'before' => '<small>', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
    <td class="num"><?php forum_topics(); ?></td>
    <td class="num"><?php forum_posts(); ?></td>
    </tr>

    <?php endwhile; ?>
    </table>
    <?php endif; // bb_forums() ?>

    Which works great but I have to have every title under a category now. If I have a forum title “Websites” not under a category, this is what I get:

    Websites00

    –Welcome


    Topic–Post

    —Welcome to Our Site


    0


    0

    -Support


    Topic–Post

    —PHP Help



    0


    0

    Or it latches itself to another category

    –Welcome


    Topic–Post

    —Welcome to Our Site


    0


    0

    —PHP Help


    0


    0

    -Support


    Topic–Post

    —PHP Help



    0


    0

    So I need a statement that says if it’s not in a category it will print the title ONCE

    <tr>
    <th><?php _e('Main Theme'); ?></th>
    <th><?php _e('Topics'); ?></th>
    <th><?php _e('Posts'); ?></th>
    </tr>

    So it will print:

    –Welcome


    Topic–Post

    —Welcome to Our Site


    0


    0

    -Support


    Topic–Post

    —PHP Help



    0


    0

    -Main Theme


    Topic–Post

    —PHP Help


    0


    0

    Make sense?

Viewing 2 replies - 1 through 2 (of 2 total)

  • miruru
    Member

    @miruru

    Hi there, I think it is similar to what I have set up.

    For Example, the Welcome/Support/Main Theme are the Forum tables with subforums underneath?

    Take a look at this https://bbpress.org/forums/topic/displaying-sub-sub-forums you can remove the subforum bit from this as well.


    gerikg
    Member

    @gerikg

    The code seem incomplete or am I missing something? “If you want the code, here it is: http://pastie.org/896738.txt.&#8221;

    and I don’t think that answers my question.

    I would like the categories to be in one table (which I got) and the topics that aren’t in a category in its own table (which I can’t get)

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