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