@@ 1065-1091 (lines=27) @@ | ||
1062 | * @param string $feed Optional. Feed type. Default empty. |
|
1063 | * @return string The search results feed permalink. |
|
1064 | */ |
|
1065 | function get_search_feed_link($search_query = '', $feed = '') { |
|
1066 | global $wp_rewrite; |
|
1067 | $link = get_search_link($search_query); |
|
1068 | ||
1069 | if ( empty($feed) ) |
|
1070 | $feed = get_default_feed(); |
|
1071 | ||
1072 | $permastruct = $wp_rewrite->get_search_permastruct(); |
|
1073 | ||
1074 | if ( empty($permastruct) ) { |
|
1075 | $link = add_query_arg('feed', $feed, $link); |
|
1076 | } else { |
|
1077 | $link = trailingslashit($link); |
|
1078 | $link .= "feed/$feed/"; |
|
1079 | } |
|
1080 | ||
1081 | /** |
|
1082 | * Filters the search feed link. |
|
1083 | * |
|
1084 | * @since 2.5.0 |
|
1085 | * |
|
1086 | * @param string $link Search feed link. |
|
1087 | * @param string $feed Feed type. |
|
1088 | * @param string $type The search type. One of 'posts' or 'comments'. |
|
1089 | */ |
|
1090 | return apply_filters( 'search_feed_link', $link, $feed, 'posts' ); |
|
1091 | } |
|
1092 | ||
1093 | /** |
|
1094 | * Retrieves the permalink for the search results comments feed. |
|
@@ 1104-1121 (lines=18) @@ | ||
1101 | * @param string $feed Optional. Feed type. Default empty. |
|
1102 | * @return string The comments feed search results permalink. |
|
1103 | */ |
|
1104 | function get_search_comments_feed_link($search_query = '', $feed = '') { |
|
1105 | global $wp_rewrite; |
|
1106 | ||
1107 | if ( empty($feed) ) |
|
1108 | $feed = get_default_feed(); |
|
1109 | ||
1110 | $link = get_search_feed_link($search_query, $feed); |
|
1111 | ||
1112 | $permastruct = $wp_rewrite->get_search_permastruct(); |
|
1113 | ||
1114 | if ( empty($permastruct) ) |
|
1115 | $link = add_query_arg('feed', 'comments-' . $feed, $link); |
|
1116 | else |
|
1117 | $link = add_query_arg('withcomments', 1, $link); |
|
1118 | ||
1119 | /** This filter is documented in wp-includes/link-template.php */ |
|
1120 | return apply_filters( 'search_feed_link', $link, $feed, 'comments' ); |
|
1121 | } |
|
1122 | ||
1123 | /** |
|
1124 | * Retrieves the permalink for a post type archive. |