Skip to:
Content
Pages
Categories
Search
Top
Bottom

Can you only use the LOOP once per page.

  • if you goto the frontpage.php at http://www.massbase.com… on the side bar to the right, (which is the footer.php) there is an extra loop that shows the instant classifed forums (in the black box)…

    however if i click on any topic or any page on the site… that loop stops displaying the topics of that forum..

    how come ?

    this is the code im using for the loops in that black box (which is the same code for all the forums on the frontpage)

    <h3 style="color: red;"><?php forum_name(4); ?></h3>
    <?php
    $count=0;
    if ( $topics )
    {
    foreach ( $topics as $topic)
    {
    if ($topic->forum_id=="4")
    {
    if($count<5)
    $count++;
    else
    break;
    ?>
    <br />- <?php bb_topic_labels(); ?> <a style="font-weight:bold; color: white;line-height: 2.5em;" href="<?php topic_link(); ?>"><?php topic_title(); ?></a><?php topic_page_links(); ?>
    <?php
    }
    }
    }
    ?>
    <br /><br /><a id="sub-link" href="<?php bb_uri(); ?>forum/instant-classified"> View all General Topics</a>

Viewing 4 replies - 1 through 4 (of 4 total)
  • the right sidebar is just the footer.php


    Sam Bauers
    Participant

    @sambauers

    Because the loop relies on the $topics global being set by the base index.php file.

    $topics = get_latest_topics(false, $page);

    You can add this to your template if you like just above that loop, to make sure $topics is always available…

    if ( !isset( $topics ) ) {
    $topics = get_latest_topics( false, 1 ); // Only fetch the first page
    }

    thanks sam it works.

    now i can loop through certain forums anywhere on the site.

    many thanks for everything.

    guys check it out http://www.massbase.com

    you can do anything with bb-press.

    Its just code that works. Real power is the pluggable nature of bbPress & WordPress which lets you add almost any functionality without bloating the code for mass consumption.

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