Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/14/2011 01:33:23 AM (10 years ago)
Author:
johnjamesjacoby
Message:

Fix pagination issues when using topics shortcode on front page. Also use pagination_base instead of 'page'.

Fixes #1567, #1573. Props scribu.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-topic-template.php

    r3354 r3361  
    239239            // Profile page
    240240            if ( bbp_is_single_user() )
    241                 $base = user_trailingslashit( trailingslashit( bbp_get_user_profile_url( bbp_get_displayed_user_id() ) ) . 'page/%#%/' );
     241                $base = bbp_get_user_profile_url( bbp_get_displayed_user_id() );
    242242
    243243            // View
    244244            elseif ( bbp_is_single_view() )
    245                 $base = user_trailingslashit( trailingslashit( bbp_get_view_url() ) . 'page/%#%/' );
     245                $base = bbp_get_view_url();
    246246
    247247            // Page or single post
    248248            elseif ( is_page() || is_single() )
    249                 $base = user_trailingslashit( trailingslashit( get_permalink() ) . 'page/%#%/' );
     249                $base = get_permalink();
    250250
    251251            // Topic archive
    252252            elseif ( bbp_is_topic_archive() )
    253                 $base = user_trailingslashit( trailingslashit( home_url( $bbp->topic_archive_slug ) ) . 'page/%#%/' );
     253                $base = home_url( $bbp->topic_archive_slug );
    254254
    255255            // Default
    256256            else
    257                 $base = user_trailingslashit( trailingslashit( get_permalink( $post_parent ) ) . 'page/%#%/' );
     257                $base = get_permalink( $post_parent );
     258
     259            // Use pagination base
     260            $base = trailingslashit( $base ) . user_trailingslashit( $wp_rewrite->pagination_base . '/%#%/' );
    258261
    259262        // Unpretty pagination
     
    277280
    278281        // Remove first page from pagination
    279         $bbp->topic_query->pagination_links = str_replace( 'page/1/\'', '\'', $bbp->topic_query->pagination_links );
     282        $bbp->topic_query->pagination_links = str_replace( $wp_rewrite->pagination_base . "/1/'", "'", $bbp->topic_query->pagination_links );
    280283    }
    281284
     
    656659        // If pretty permalinks are enabled, make our pagination pretty
    657660        if ( $wp_rewrite->using_permalinks() )
    658             $base = user_trailingslashit( trailingslashit( get_permalink( $topic_id ) ) . 'page/%#%/' );
     661            $base = trailingslashit( get_permalink( $topic_id ) ) . user_trailingslashit( $wp_rewrite->pagination_base . '/%#%/' );
    659662        else
    660663            $base = add_query_arg( 'paged', '%#%' );
     
    684687            // Remove first page from pagination
    685688            if ( $wp_rewrite->using_permalinks() )
    686                 $pagination_links = str_replace( 'page/1/',      '', $pagination_links );
     689                $pagination_links = str_replace( $wp_rewrite->pagination_base . '/1/', '', $pagination_links );
    687690            else
    688691                $pagination_links = str_replace( '&paged=1', '', $pagination_links );
Note: See TracChangeset for help on using the changeset viewer.