Skip to:
Content

BuddyPress.org

Changeset 4496


Ignore:
Timestamp:
06/12/2011 02:15:33 PM (15 years ago)
Author:
djpaul
Message:

Move next/previous page navigation links into a convenience function. Props twentyeleven theme team for idea.
Also adds these navigation links to the top of the index template, to match archive and search templates.

Location:
trunk/bp-themes/bp-default
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/archive.php

    r4412 r4496  
    1212            <?php if ( have_posts() ) : ?>
    1313
    14                 <div id="nav-above" class="navigation">
    15 
    16                     <div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
    17                     <div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
    18 
    19                 </div>
     14                <?php bp_dtheme_content_nav( 'nav-above' ); ?>
    2015
    2116                <?php while (have_posts()) : the_post(); ?>
     
    4944                <?php endwhile; ?>
    5045
    51                 <div id="nav-below" class="navigation">
    52 
    53                     <div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
    54                     <div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
    55 
    56                 </div>
     46                <?php bp_dtheme_content_nav( 'nav-below' ); ?>
    5747
    5848            <?php else : ?>
  • trunk/bp-themes/bp-default/functions.php

    r4479 r4496  
    673673add_action( 'bp_sidebar_login_form', 'bp_dtheme_sidebar_login_redirect_to' );
    674674endif;
     675
     676/**
     677 * Display navigation to next/previous pages when applicable
     678 *
     679 * @global unknown $wp_query
     680 * @param string $nav_id DOM ID for this navigation
     681 * @since 1.3
     682 */
     683function bp_dtheme_content_nav( $nav_id ) {
     684    global $wp_query;
     685
     686    if ( $wp_query->max_num_pages > 1 ) : ?>
     687        <div id="<?php echo $nav_id; ?>" class="navigation">
     688            <div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ); ?></div>
     689            <div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ); ?></div>
     690        </div><!-- #<?php echo $nav_id; ?> -->
     691    <?php endif;
     692}
    675693?>
  • trunk/bp-themes/bp-default/index.php

    r4465 r4496  
    1111
    1212            <?php if ( have_posts() ) : ?>
     13
     14                <?php bp_dtheme_content_nav( 'nav-above' ); ?>
    1315
    1416                <?php while (have_posts()) : the_post(); ?>
     
    4244                <?php endwhile; ?>
    4345
    44                 <div id="nav-below" class="navigation">
    45 
    46                     <div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
    47                     <div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
    48 
    49                 </div>
     46                <?php bp_dtheme_content_nav( 'nav-below' ); ?>
    5047
    5148            <?php else : ?>
  • trunk/bp-themes/bp-default/search.php

    r4466 r4496  
    1414                <h3 class="pagetitle"><?php _e( 'Search Results', 'buddypress' ) ?></h3>
    1515
    16                 <div id="nav-above" class="navigation">
    17                     <div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
    18                     <div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
    19                 </div>
     16                <?php bp_dtheme_content_nav( 'nav-above' ); ?>
    2017
    2118                <?php while (have_posts()) : the_post(); ?>
     
    4845                <?php endwhile; ?>
    4946
    50                 <div id="nav-below" class="navigation">
    51                     <div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
    52                     <div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
    53                 </div>
     47                <?php bp_dtheme_content_nav( 'nav-below' ); ?>
    5448
    5549            <?php else : ?>
Note: See TracChangeset for help on using the changeset viewer.