Changeset 2612
- Timestamp:
- 02/07/2010 12:22:22 AM (16 years ago)
- Location:
- trunk/bp-themes/bp-default
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/bp-default/functions.php
r2605 r2612 21 21 /* Load the javascript for the theme */ 22 22 wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) ); 23 24 /* Make sure the blog index page shows under /[HOME_BLOG_SLUG] if enabled */25 function bp_dtheme_show_home_blog() {26 global $bp, $query_string, $paged;27 28 if ( $bp->current_component == BP_HOME_BLOG_SLUG && ( !$bp->current_action || 'page' == $bp->current_action ) ) {29 unset( $query_string );30 31 if ( ( 'page' == $bp->current_action && $bp->action_variables[0] ) && false === strpos( $query_string, 'paged' ) ) {32 $query_string .= '&paged=' . $bp->action_variables[0];33 $paged = $bp->action_variables[0];34 }35 36 query_posts($query_string);37 38 bp_core_load_template( 'index', true );39 }40 }41 add_action( 'wp', 'bp_dtheme_show_home_blog', 2 );42 23 43 24 function bp_dtheme_firstname( $name = false, $echo = false ) { … … 101 82 } 102 83 103 function bp_dtheme_show_on_frontpage() { 104 $settings = get_option( 'bp_dtheme_options' ); 105 106 if ( empty( $settings['show_on_frontpage'] ) || 'blog' == $settings['show_on_frontpage'] ) 107 return apply_filters( 'bp_dtheme_show_on_frontpage', 'blog' ); 108 109 return apply_filters( 'bp_dtheme_show_on_frontpage', 'activity' ); 84 function bp_dtheme_wp_pages_filter( $page_html ) { 85 if ( 'page_on_front' != substr( $page_html, 14, 13 ) ) 86 return $page_html; 87 88 $selected = false; 89 $page_html = str_replace( '</select>', '', $page_html ); 90 91 if ( bp_dtheme_page_on_front() == 'activity' ) 92 $selected = ' selected="selected"'; 93 94 $page_html .= '<option class="level-0" value="activity"' . $selected . '>' . __( 'Activity Stream', 'buddypress' ) . '</option></select>'; 95 return $page_html; 96 } 97 add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' ); 98 99 function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) { 100 if ( !is_admin() || !is_site_admin() ) 101 return false; 102 103 if ( 'activity' == $_POST['page_on_front'] ) 104 return 'activity'; 105 else 106 return $oldvalue; 107 } 108 add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 ); 109 110 function bp_dtheme_page_on_front_template( $template ) { 111 global $wp_query; 112 113 if ( empty( $wp_query->post->ID ) ) 114 return locate_template( array( 'activity/index.php' ), false ); 115 else 116 return $template; 117 } 118 add_filter( 'page_template', 'bp_dtheme_page_on_front_template' ); 119 120 /* Return the ID of a page set as the home page. */ 121 function bp_dtheme_page_on_front() { 122 return apply_filters( 'bp_dtheme_page_on_front', get_option( 'page_on_front' ) ); 110 123 } 111 124 … … 220 233 } 221 234 222 /* Load the options page */223 if ( is_admin() )224 require( TEMPLATEPATH . '/_inc/options.php' );225 226 235 /* Adjust home page body class if activity stream is home */ 227 236 function bp_dtheme_body_class_home( $classes, $bp_classes, $wp_classes, $custom_classes ) { … … 230 239 231 240 if ( bp_is_active( 'activity' ) ) { 232 if ( 'activity' == bp_dtheme_ show_on_frontpage() ) {241 if ( 'activity' == bp_dtheme_page_on_front() ) { 233 242 $blog = array_keys( $classes, 'blog-page' ); 234 243 $classes[$blog[0]] = 'activity'; -
trunk/bp-themes/bp-default/header.php
r2610 r2612 45 45 46 46 <ul id="nav"> 47 <li<?php if ( bp_is_page( 'home' ) && !is_page() ) : ?> class="selected"<?php endif; ?>>47 <li<?php if ( is_front_page() || !bp_current_component() ) : ?> class="selected"<?php endif; ?>> 48 48 <a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a> 49 49 </li> 50 50 51 <?php if ( bp_is_active( 'activity' ) ) : ?> 52 <?php if ( 'blog' == bp_dtheme_show_on_frontpage() ) : ?> 53 <li<?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?> class="selected"<?php endif; ?>> 54 <a href="<?php echo site_url() ?>/<?php echo BP_ACTIVITY_SLUG ?>/" title="<?php _e( 'Activity', 'buddypress' ) ?>"><?php _e( 'Activity', 'buddypress' ) ?></a> 55 </li> 56 <?php else : ?> 57 <li<?php if ( bp_is_page( BP_HOME_BLOG_SLUG ) || bp_is_blog_page() && !is_front_page() && !is_page() ) : ?> class="selected"<?php endif; ?>> 58 <a href="<?php echo site_url() ?>/<?php echo BP_HOME_BLOG_SLUG ?>/" title="<?php _e( 'Blog', 'buddypress' ) ?>"><?php _e( 'Blog', 'buddypress' ) ?></a> 59 </li> 60 <?php endif; ?> 51 <?php if ( 'activity' != bp_dtheme_page_on_front() && bp_is_active( 'activity' ) ) : ?> 52 <li<?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?> class="selected"<?php endif; ?>> 53 <a href="<?php echo site_url() ?>/<?php echo BP_ACTIVITY_SLUG ?>/" title="<?php _e( 'Activity', 'buddypress' ) ?>"><?php _e( 'Activity', 'buddypress' ) ?></a> 54 </li> 61 55 <?php endif; ?> 62 56 63 <li<?php if ( 57 <li<?php if ( bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) : ?> class="selected"<?php endif; ?>> 64 58 <a href="<?php echo site_url() ?>/<?php echo BP_MEMBERS_SLUG ?>/" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a> 65 59 </li> … … 83 77 <?php endif; ?> 84 78 85 <?php wp_list_pages( 'title_li=&depth=1 '); ?>79 <?php wp_list_pages( 'title_li=&depth=1&exclude=' . bp_dtheme_page_on_front() ); ?> 86 80 87 81 <?php do_action( 'bp_nav_items' ); ?>
Note: See TracChangeset
for help on using the changeset viewer.