Skip to:
Content

bbPress.org

Changeset 4935


Ignore:
Timestamp:
05/20/2013 10:48:51 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Allow topics to replace the forum archive:

  • Add condition to bbp_parse_args() and add a specific query variable early, and use this variable in bbp_is_forum_archive().
  • Add condition to display_forum_archive() shortcode, to output topics if set.
  • Add forum archive check to bbp_has_topics(), to ensure pagination links are correct.
  • See #1500.
Location:
trunk/includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/template-tags.php

    r4921 r4935  
    146146 */
    147147function bbp_is_forum_archive() {
     148    global $wp_query;
    148149
    149150    // Default to false
     
    151152
    152153    // In forum archive
    153     if ( is_post_type_archive( bbp_get_forum_post_type() ) || bbp_is_query_name( 'bbp_forum_archive' ) )
     154    if ( is_post_type_archive( bbp_get_forum_post_type() ) || bbp_is_query_name( 'bbp_forum_archive' ) || !empty( $wp_query->bbp_show_topics_on_root ) )
    154155        $retval = true;
    155156
  • trunk/includes/core/template-functions.php

    r4931 r4935  
    510510        $posts_query->set( 'post_type',      bbp_get_topic_post_type() );
    511511        $posts_query->set( 'posts_per_page', bbp_get_topics_per_page() );
     512
     513    // Do topics on forums root
     514    } elseif ( is_post_type_archive( bbp_get_topic_post_type() ) && ( 'topics' === bbp_show_on_root() ) ) {
     515        $posts_query->bbp_show_topics_on_root = true;
    512516    }
    513517}
  • trunk/includes/core/theme-compat.php

    r4608 r4935  
    751751            add_filter( 'the_content', 'bbp_replace_the_content' );
    752752
     753        // Use the topics archive
     754        } elseif ( 'topics' === bbp_show_on_root() ) {
     755            $new_content = $bbp->shortcodes->display_topics_index();
     756
    753757        // No page so show the archive
    754758        } else {
  • trunk/includes/topics/template-tags.php

    r4896 r4935  
    309309                $base = get_permalink();
    310310
     311            // Forum archive
     312            } elseif ( bbp_is_forum_archive() ) {
     313                $base = bbp_get_forums_url();
     314
    311315            // Topic archive
    312316            } elseif ( bbp_is_topic_archive() ) {
Note: See TracChangeset for help on using the changeset viewer.