Changeset 3809
- Timestamp:
- 08/15/2016 05:43:19 PM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
r3796 r3809 987 987 function post_type_has_usage_info( $post_type = null ) { 988 988 $post_type = $post_type ? $post_type : get_post_type(); 989 $post_types_with_usage = array( 'wp-parser-function', 'wp-parser-method', 'wp-parser-hook' );989 $post_types_with_usage = array( 'wp-parser-function', 'wp-parser-method', 'wp-parser-hook', 'wp-parser-class' ); 990 990 991 991 return in_array( $post_type, $post_types_with_usage ); … … 1001 1001 function post_type_has_uses_info( $post_type = null ) { 1002 1002 $post_type = $post_type ? $post_type : get_post_type(); 1003 $post_types_with_uses = array( 'wp-parser-function', 'wp-parser-method' );1003 $post_types_with_uses = array( 'wp-parser-function', 'wp-parser-method', 'wp-parser-class' ); 1004 1004 1005 1005 return in_array( $post_type, $post_types_with_uses ); … … 1012 1012 */ 1013 1013 function get_uses() { 1014 1015 if ( 'wp-parser-function' === get_post_type() ) { 1014 $post_type = get_post_type(); 1015 1016 if ( 'wp-parser-class' === $post_type ) { 1017 $extends = get_post_meta( get_the_ID(), '_wp-parser_extends', true ); 1018 if ( ! $extends ) { 1019 return; 1020 } 1021 $connected = new \WP_Query( array( 1022 'post_type' => array( 'wp-parser-class' ), 1023 'name' => $extends, 1024 ) ); 1025 return $connected; 1026 } elseif ( 'wp-parser-function' === $post_type ) { 1016 1027 $connection_types = array( 'functions_to_functions', 'functions_to_methods', 'functions_to_hooks' ); 1017 1028 } else { … … 1048 1059 case 'wp-parser-hook': 1049 1060 $connection_types = array( 'functions_to_hooks', 'methods_to_hooks' ); 1061 break; 1062 1063 case 'wp-parser-class': 1064 $connected = new \WP_Query( array( 1065 'post_type' => array( 'wp-parser-class' ), 1066 'meta_key' => '_wp-parser_extends', 1067 'meta_value' => get_post_field( 'post_name', get_post( $post_id ) ), 1068 ) ); 1069 return $connected; 1050 1070 break; 1051 1071 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/reference/template-related.php
r3660 r3809 22 22 $uses = get_uses(); 23 23 $uses_to_show = 5; 24 while ( $uses->have_posts() ) : $uses->the_post()24 if ( $uses ) : while ( $uses->have_posts() ) : $uses->the_post() 25 25 ?> 26 26 <li> … … 37 37 ?></a> 38 38 <a href="#" class="hide-more"><?php _e( 'Hide more uses', 'wporg' ); ?></a> 39 <?php endif; ?>39 <?php endif; endif; ?> 40 40 </ul> 41 41 </article>
Note: See TracChangeset
for help on using the changeset viewer.