関数 get_post_type_archive_link()
2015/01/09
関数 get_post_type_archive_link()
定義ファイル :/blog/wp-includes/link-template.php 3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | function get_post_type_archive_link( $post_type ) { global $wp_rewrite; if ( ! $post_type_obj = get_post_type_object( $post_type ) ) return false; if ( ! $post_type_obj->has_archive ) return false; if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) { $struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive; if ( $post_type_obj->rewrite['with_front'] ) $struct = $wp_rewrite->front . $struct; else $struct = $wp_rewrite->root . $struct; $link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) ); } else { $link = home_url( '?post_type=' . $post_type ); } return apply_filters( 'post_type_archive_link', $link, $post_type ); } |