Changeset 3883
- Timestamp:
- 08/30/2016 06:27:46 PM (10 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-forums
- Files:
-
- 2 edited
-
functions.php (modified) (1 diff)
-
page-homepage.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-forums/functions.php
r3798 r3883 89 89 /** 90 90 * Register these bbPress views: 91 * View: All Topics 92 * @ToDo View: Not Resolved 93 * @ToDo View: modlook 91 * View: All topics 92 * View: Tagged modlook 94 93 * 95 94 * @uses bbp_register_view() To register the view 96 95 */ 97 96 function wporg_support_custom_views() { 98 bbp_register_view( 'all-topics', __( 'All Topics', 'wporg-forums' ), array( 'order' => 'DESC' ), false ); 99 // bbp_register_view( 'support-forum-no', __( 'Not Resolved', 'wporg-forums' ), array( 'post_status' => 'closed' ), false ); 100 // bbp_register_view( 'taggedmodlook', __( 'Tagged modlook', 'wporg-forums' ), array( 'topic-tag' => 'modlook' ) ); 97 bbp_register_view( 'all-topics', __( 'All topics', 'wporg-forums' ), array( 'order' => 'DESC' ), false ); 98 if ( get_current_user_id() && current_user_can( 'moderate' ) ) { 99 bbp_register_view( 'taggedmodlook', __( 'Tagged modlook', 'wporg-forums' ), array( 'topic-tag' => 'modlook' ) ); 100 } 101 101 } 102 102 add_action( 'bbp_register_views', 'wporg_support_custom_views' ); 103 104 /** 105 * Display an ordered list of bbPress views 106 */ 107 function wporg_support_get_views() { 108 $all = bbp_get_views(); 109 $ordered = array( 110 'all-topics', 111 'no-replies', 112 'support-forum-no', 113 'taggedmodlook', 114 ); 115 $found = array(); 116 foreach ( $ordered as $view ) { 117 if ( array_key_exists( $view, $all ) ) { 118 $found[] = $view; 119 } 120 } 121 $view_iterator = 0; 122 $view_count = count( $found ); 123 124 foreach ( $found as $view ) : $view_iterator++; ?> 125 126 <li class="view"><a href="<?php bbp_view_url( $view ); ?>"><?php bbp_view_title( $view ); ?></a></li> 127 128 <?php if ( $view_iterator < $view_count ) : ?>|<?php endif; ?> 129 130 <?php endforeach; 131 132 // Unset variables 133 unset( $view_count, $view_iterator, $view, $found, $all, $ordered ); 134 } 103 135 104 136 /** -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-forums/page-homepage.php
r2063 r3883 44 44 <div id="viewdiv"> 45 45 <ul id="views"> 46 47 <?php 48 $view_iterator = 0; 49 $topic_views = array_keys( array_reverse( bbp_get_views() ) ); 50 $view_count = count( $topic_views ); 51 52 foreach ( $topic_views as $view ) : $view_iterator++; ?> 53 54 <li class="view"><a href="<?php bbp_view_url( $view ); ?>"><?php bbp_view_title( $view ); ?></a></li> 55 56 <?php if ( $view_iterator < $view_count ) : ?>|<?php endif; ?> 57 58 <?php endforeach; 59 60 // Unset variables 61 unset( $view_count, $topic_views ); ?> 62 46 <?php wporg_support_get_views(); ?> 63 47 </ul> 64 48 </div><!-- #viewdiv -->
Note: See TracChangeset
for help on using the changeset viewer.