Changeset 3810
- Timestamp:
- 08/15/2016 06:46:02 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
r3809 r3810 1007 1007 1008 1008 /** 1009 * Retrieve a WP_Query object for the posts that the current post uses 1010 * 1011 * @return WP_Query A WP_Query object for the posts the current post uses 1012 */ 1013 function get_uses() { 1014 $post_type = get_post_type(); 1009 * Retrieves a WP_Query object for the posts that the current post uses. 1010 * 1011 * @param int|WP_Post|null $post Optional. Post ID or post object. Default is global $post. 1012 * @return WP_Query|null The WP_Query if the post's post type supports 'uses', null otherwise. 1013 */ 1014 function get_uses( $post = null ) { 1015 $post_id = get_post_field( 'ID', $post ); 1016 $post_type = get_post_type( $post ); 1015 1017 1016 1018 if ( 'wp-parser-class' === $post_type ) { 1017 $extends = get_post_meta( get_the_ID(), '_wp-parser_extends', true );1019 $extends = get_post_meta( $post_id, '_wp-parser_extends', true ); 1018 1020 if ( ! $extends ) { 1019 1021 return; … … 1034 1036 'connected_type' => $connection_types, 1035 1037 'connected_direction' => array( 'from', 'from', 'from' ), 1036 'connected_items' => get_the_ID(),1038 'connected_items' => $post_id, 1037 1039 'nopaging' => true, 1038 1040 ) ); … … 1041 1043 } 1042 1044 1043 function get_used_by( $post_id = null ) { 1044 1045 if ( empty( $post_id ) ) { 1046 $post_id = get_the_ID(); 1047 } 1048 1049 switch ( get_post_type() ) { 1045 /** 1046 * Retrieves a WP_Query object for the posts that use the specified post. 1047 * 1048 * @param int|WP_Post|null $post Optional. Post ID or post object. Default is global $post. 1049 * @return WP_Query|null The WP_Query if the post's post type supports 'used by', null otherwise. 1050 */ 1051 function get_used_by( $post = null ) { 1052 1053 switch ( get_post_type( $post ) ) { 1050 1054 1051 1055 case 'wp-parser-function': … … 1065 1069 'post_type' => array( 'wp-parser-class' ), 1066 1070 'meta_key' => '_wp-parser_extends', 1067 'meta_value' => get_post_field( 'post_name', get_post( $post_id )),1071 'meta_value' => get_post_field( 'post_name', $post ), 1068 1072 ) ); 1069 return $connected; 1073 return $connected; 1070 1074 break; 1071 1075 … … 1079 1083 'connected_type' => $connection_types, 1080 1084 'connected_direction' => array( 'to', 'to' ), 1081 'connected_items' => $post_id,1085 'connected_items' => get_post_field( 'ID', $post ), 1082 1086 'nopaging' => true, 1083 1087 ) );
Note: See TracChangeset
for help on using the changeset viewer.