Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu...
File: link-template.php
$result = get_post( $result );
[2000] Fix | Delete
}
[2001] Fix | Delete
return $result;
[2002] Fix | Delete
}
[2003] Fix | Delete
[2004] Fix | Delete
$result = $wpdb->get_var( $query );
[2005] Fix | Delete
if ( null === $result ) {
[2006] Fix | Delete
$result = '';
[2007] Fix | Delete
}
[2008] Fix | Delete
[2009] Fix | Delete
wp_cache_set( $cache_key, $result, 'post-queries' );
[2010] Fix | Delete
[2011] Fix | Delete
if ( $result ) {
[2012] Fix | Delete
$result = get_post( $result );
[2013] Fix | Delete
}
[2014] Fix | Delete
[2015] Fix | Delete
return $result;
[2016] Fix | Delete
}
[2017] Fix | Delete
[2018] Fix | Delete
/**
[2019] Fix | Delete
* Retrieves the adjacent post relational link.
[2020] Fix | Delete
*
[2021] Fix | Delete
* Can either be next or previous post relational link.
[2022] Fix | Delete
*
[2023] Fix | Delete
* @since 2.8.0
[2024] Fix | Delete
*
[2025] Fix | Delete
* @param string $title Optional. Link title format. Default '%title'.
[2026] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2027] Fix | Delete
* Default false.
[2028] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2029] Fix | Delete
* Default empty.
[2030] Fix | Delete
* @param bool $previous Optional. Whether to display link to previous or next post.
[2031] Fix | Delete
* Default true.
[2032] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2033] Fix | Delete
* @return string|void The adjacent post relational link URL.
[2034] Fix | Delete
*/
[2035] Fix | Delete
function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
[2036] Fix | Delete
$post = get_post();
[2037] Fix | Delete
if ( $previous && is_attachment() && $post ) {
[2038] Fix | Delete
$post = get_post( $post->post_parent );
[2039] Fix | Delete
} else {
[2040] Fix | Delete
$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
[2041] Fix | Delete
}
[2042] Fix | Delete
[2043] Fix | Delete
if ( empty( $post ) ) {
[2044] Fix | Delete
return;
[2045] Fix | Delete
}
[2046] Fix | Delete
[2047] Fix | Delete
$post_title = the_title_attribute(
[2048] Fix | Delete
array(
[2049] Fix | Delete
'echo' => false,
[2050] Fix | Delete
'post' => $post,
[2051] Fix | Delete
)
[2052] Fix | Delete
);
[2053] Fix | Delete
[2054] Fix | Delete
if ( empty( $post_title ) ) {
[2055] Fix | Delete
$post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
[2056] Fix | Delete
}
[2057] Fix | Delete
[2058] Fix | Delete
$date = mysql2date( get_option( 'date_format' ), $post->post_date );
[2059] Fix | Delete
[2060] Fix | Delete
$title = str_replace( '%title', $post_title, $title );
[2061] Fix | Delete
$title = str_replace( '%date', $date, $title );
[2062] Fix | Delete
[2063] Fix | Delete
$link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
[2064] Fix | Delete
$link .= esc_attr( $title );
[2065] Fix | Delete
$link .= "' href='" . get_permalink( $post ) . "' />\n";
[2066] Fix | Delete
[2067] Fix | Delete
$adjacent = $previous ? 'previous' : 'next';
[2068] Fix | Delete
[2069] Fix | Delete
/**
[2070] Fix | Delete
* Filters the adjacent post relational link.
[2071] Fix | Delete
*
[2072] Fix | Delete
* The dynamic portion of the hook name, `$adjacent`, refers to the type
[2073] Fix | Delete
* of adjacency, 'next' or 'previous'.
[2074] Fix | Delete
*
[2075] Fix | Delete
* Possible hook names include:
[2076] Fix | Delete
*
[2077] Fix | Delete
* - `next_post_rel_link`
[2078] Fix | Delete
* - `previous_post_rel_link`
[2079] Fix | Delete
*
[2080] Fix | Delete
* @since 2.8.0
[2081] Fix | Delete
*
[2082] Fix | Delete
* @param string $link The relational link.
[2083] Fix | Delete
*/
[2084] Fix | Delete
return apply_filters( "{$adjacent}_post_rel_link", $link );
[2085] Fix | Delete
}
[2086] Fix | Delete
[2087] Fix | Delete
/**
[2088] Fix | Delete
* Displays the relational links for the posts adjacent to the current post.
[2089] Fix | Delete
*
[2090] Fix | Delete
* @since 2.8.0
[2091] Fix | Delete
*
[2092] Fix | Delete
* @param string $title Optional. Link title format. Default '%title'.
[2093] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2094] Fix | Delete
* Default false.
[2095] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2096] Fix | Delete
* Default empty.
[2097] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2098] Fix | Delete
*/
[2099] Fix | Delete
function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[2100] Fix | Delete
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
[2101] Fix | Delete
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
[2102] Fix | Delete
}
[2103] Fix | Delete
[2104] Fix | Delete
/**
[2105] Fix | Delete
* Displays relational links for the posts adjacent to the current post for single post pages.
[2106] Fix | Delete
*
[2107] Fix | Delete
* This is meant to be attached to actions like 'wp_head'. Do not call this directly in plugins
[2108] Fix | Delete
* or theme templates.
[2109] Fix | Delete
*
[2110] Fix | Delete
* @since 3.0.0
[2111] Fix | Delete
* @since 5.6.0 No longer used in core.
[2112] Fix | Delete
*
[2113] Fix | Delete
* @see adjacent_posts_rel_link()
[2114] Fix | Delete
*/
[2115] Fix | Delete
function adjacent_posts_rel_link_wp_head() {
[2116] Fix | Delete
if ( ! is_single() || is_attachment() ) {
[2117] Fix | Delete
return;
[2118] Fix | Delete
}
[2119] Fix | Delete
adjacent_posts_rel_link();
[2120] Fix | Delete
}
[2121] Fix | Delete
[2122] Fix | Delete
/**
[2123] Fix | Delete
* Displays the relational link for the next post adjacent to the current post.
[2124] Fix | Delete
*
[2125] Fix | Delete
* @since 2.8.0
[2126] Fix | Delete
*
[2127] Fix | Delete
* @see get_adjacent_post_rel_link()
[2128] Fix | Delete
*
[2129] Fix | Delete
* @param string $title Optional. Link title format. Default '%title'.
[2130] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2131] Fix | Delete
* Default false.
[2132] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2133] Fix | Delete
* Default empty.
[2134] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2135] Fix | Delete
*/
[2136] Fix | Delete
function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[2137] Fix | Delete
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
[2138] Fix | Delete
}
[2139] Fix | Delete
[2140] Fix | Delete
/**
[2141] Fix | Delete
* Displays the relational link for the previous post adjacent to the current post.
[2142] Fix | Delete
*
[2143] Fix | Delete
* @since 2.8.0
[2144] Fix | Delete
*
[2145] Fix | Delete
* @see get_adjacent_post_rel_link()
[2146] Fix | Delete
*
[2147] Fix | Delete
* @param string $title Optional. Link title format. Default '%title'.
[2148] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2149] Fix | Delete
* Default false.
[2150] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2151] Fix | Delete
* Default true.
[2152] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2153] Fix | Delete
*/
[2154] Fix | Delete
function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[2155] Fix | Delete
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
[2156] Fix | Delete
}
[2157] Fix | Delete
[2158] Fix | Delete
/**
[2159] Fix | Delete
* Retrieves the boundary post.
[2160] Fix | Delete
*
[2161] Fix | Delete
* Boundary being either the first or last post by publish date within the constraints specified
[2162] Fix | Delete
* by `$in_same_term` or `$excluded_terms`.
[2163] Fix | Delete
*
[2164] Fix | Delete
* @since 2.8.0
[2165] Fix | Delete
*
[2166] Fix | Delete
* @param bool $in_same_term Optional. Whether returned post should be in the same taxonomy term.
[2167] Fix | Delete
* Default false.
[2168] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2169] Fix | Delete
* Default empty.
[2170] Fix | Delete
* @param bool $start Optional. Whether to retrieve first or last post.
[2171] Fix | Delete
* Default true.
[2172] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2173] Fix | Delete
* @return array|null Array containing the boundary post object if successful, null otherwise.
[2174] Fix | Delete
*/
[2175] Fix | Delete
function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
[2176] Fix | Delete
$post = get_post();
[2177] Fix | Delete
[2178] Fix | Delete
if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) ) {
[2179] Fix | Delete
return null;
[2180] Fix | Delete
}
[2181] Fix | Delete
[2182] Fix | Delete
$query_args = array(
[2183] Fix | Delete
'posts_per_page' => 1,
[2184] Fix | Delete
'order' => $start ? 'ASC' : 'DESC',
[2185] Fix | Delete
'update_post_term_cache' => false,
[2186] Fix | Delete
'update_post_meta_cache' => false,
[2187] Fix | Delete
);
[2188] Fix | Delete
[2189] Fix | Delete
$term_array = array();
[2190] Fix | Delete
[2191] Fix | Delete
if ( ! is_array( $excluded_terms ) ) {
[2192] Fix | Delete
if ( ! empty( $excluded_terms ) ) {
[2193] Fix | Delete
$excluded_terms = explode( ',', $excluded_terms );
[2194] Fix | Delete
} else {
[2195] Fix | Delete
$excluded_terms = array();
[2196] Fix | Delete
}
[2197] Fix | Delete
}
[2198] Fix | Delete
[2199] Fix | Delete
if ( $in_same_term || ! empty( $excluded_terms ) ) {
[2200] Fix | Delete
if ( $in_same_term ) {
[2201] Fix | Delete
$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
[2202] Fix | Delete
}
[2203] Fix | Delete
[2204] Fix | Delete
if ( ! empty( $excluded_terms ) ) {
[2205] Fix | Delete
$excluded_terms = array_map( 'intval', $excluded_terms );
[2206] Fix | Delete
$excluded_terms = array_diff( $excluded_terms, $term_array );
[2207] Fix | Delete
[2208] Fix | Delete
$inverse_terms = array();
[2209] Fix | Delete
foreach ( $excluded_terms as $excluded_term ) {
[2210] Fix | Delete
$inverse_terms[] = $excluded_term * -1;
[2211] Fix | Delete
}
[2212] Fix | Delete
$excluded_terms = $inverse_terms;
[2213] Fix | Delete
}
[2214] Fix | Delete
[2215] Fix | Delete
$query_args['tax_query'] = array(
[2216] Fix | Delete
array(
[2217] Fix | Delete
'taxonomy' => $taxonomy,
[2218] Fix | Delete
'terms' => array_merge( $term_array, $excluded_terms ),
[2219] Fix | Delete
),
[2220] Fix | Delete
);
[2221] Fix | Delete
}
[2222] Fix | Delete
[2223] Fix | Delete
return get_posts( $query_args );
[2224] Fix | Delete
}
[2225] Fix | Delete
[2226] Fix | Delete
/**
[2227] Fix | Delete
* Retrieves the previous post link that is adjacent to the current post.
[2228] Fix | Delete
*
[2229] Fix | Delete
* @since 3.7.0
[2230] Fix | Delete
*
[2231] Fix | Delete
* @param string $format Optional. Link anchor format. Default '&laquo; %link'.
[2232] Fix | Delete
* @param string $link Optional. Link permalink format. Default '%title'.
[2233] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2234] Fix | Delete
* Default false.
[2235] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2236] Fix | Delete
* Default empty.
[2237] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2238] Fix | Delete
* @return string The link URL of the previous post in relation to the current post.
[2239] Fix | Delete
*/
[2240] Fix | Delete
function get_previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[2241] Fix | Delete
return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, true, $taxonomy );
[2242] Fix | Delete
}
[2243] Fix | Delete
[2244] Fix | Delete
/**
[2245] Fix | Delete
* Displays the previous post link that is adjacent to the current post.
[2246] Fix | Delete
*
[2247] Fix | Delete
* @since 1.5.0
[2248] Fix | Delete
*
[2249] Fix | Delete
* @see get_previous_post_link()
[2250] Fix | Delete
*
[2251] Fix | Delete
* @param string $format Optional. Link anchor format. Default '&laquo; %link'.
[2252] Fix | Delete
* @param string $link Optional. Link permalink format. Default '%title'.
[2253] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2254] Fix | Delete
* Default false.
[2255] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2256] Fix | Delete
* Default empty.
[2257] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2258] Fix | Delete
*/
[2259] Fix | Delete
function previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[2260] Fix | Delete
echo get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
[2261] Fix | Delete
}
[2262] Fix | Delete
[2263] Fix | Delete
/**
[2264] Fix | Delete
* Retrieves the next post link that is adjacent to the current post.
[2265] Fix | Delete
*
[2266] Fix | Delete
* @since 3.7.0
[2267] Fix | Delete
*
[2268] Fix | Delete
* @param string $format Optional. Link anchor format. Default '&laquo; %link'.
[2269] Fix | Delete
* @param string $link Optional. Link permalink format. Default '%title'.
[2270] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2271] Fix | Delete
* Default false.
[2272] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2273] Fix | Delete
* Default empty.
[2274] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2275] Fix | Delete
* @return string The link URL of the next post in relation to the current post.
[2276] Fix | Delete
*/
[2277] Fix | Delete
function get_next_post_link( $format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[2278] Fix | Delete
return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, false, $taxonomy );
[2279] Fix | Delete
}
[2280] Fix | Delete
[2281] Fix | Delete
/**
[2282] Fix | Delete
* Displays the next post link that is adjacent to the current post.
[2283] Fix | Delete
*
[2284] Fix | Delete
* @since 1.5.0
[2285] Fix | Delete
*
[2286] Fix | Delete
* @see get_next_post_link()
[2287] Fix | Delete
*
[2288] Fix | Delete
* @param string $format Optional. Link anchor format. Default '&laquo; %link'.
[2289] Fix | Delete
* @param string $link Optional. Link permalink format. Default '%title'.
[2290] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2291] Fix | Delete
* Default false.
[2292] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
[2293] Fix | Delete
* Default empty.
[2294] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2295] Fix | Delete
*/
[2296] Fix | Delete
function next_post_link( $format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
[2297] Fix | Delete
echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
[2298] Fix | Delete
}
[2299] Fix | Delete
[2300] Fix | Delete
/**
[2301] Fix | Delete
* Retrieves the adjacent post link.
[2302] Fix | Delete
*
[2303] Fix | Delete
* Can be either next post link or previous.
[2304] Fix | Delete
*
[2305] Fix | Delete
* @since 3.7.0
[2306] Fix | Delete
*
[2307] Fix | Delete
* @param string $format Link anchor format.
[2308] Fix | Delete
* @param string $link Link permalink format.
[2309] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2310] Fix | Delete
* Default false.
[2311] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded terms IDs.
[2312] Fix | Delete
* Default empty.
[2313] Fix | Delete
* @param bool $previous Optional. Whether to display link to previous or next post.
[2314] Fix | Delete
* Default true.
[2315] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2316] Fix | Delete
* @return string The link URL of the previous or next post in relation to the current post.
[2317] Fix | Delete
*/
[2318] Fix | Delete
function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
[2319] Fix | Delete
if ( $previous && is_attachment() ) {
[2320] Fix | Delete
$post = get_post( get_post()->post_parent );
[2321] Fix | Delete
} else {
[2322] Fix | Delete
$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
[2323] Fix | Delete
}
[2324] Fix | Delete
[2325] Fix | Delete
if ( ! $post ) {
[2326] Fix | Delete
$output = '';
[2327] Fix | Delete
} else {
[2328] Fix | Delete
$title = $post->post_title;
[2329] Fix | Delete
[2330] Fix | Delete
if ( empty( $post->post_title ) ) {
[2331] Fix | Delete
$title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
[2332] Fix | Delete
}
[2333] Fix | Delete
[2334] Fix | Delete
/** This filter is documented in wp-includes/post-template.php */
[2335] Fix | Delete
$title = apply_filters( 'the_title', $title, $post->ID );
[2336] Fix | Delete
[2337] Fix | Delete
$date = mysql2date( get_option( 'date_format' ), $post->post_date );
[2338] Fix | Delete
$rel = $previous ? 'prev' : 'next';
[2339] Fix | Delete
[2340] Fix | Delete
$string = '<a href="' . get_permalink( $post ) . '" rel="' . $rel . '">';
[2341] Fix | Delete
$inlink = str_replace( '%title', $title, $link );
[2342] Fix | Delete
$inlink = str_replace( '%date', $date, $inlink );
[2343] Fix | Delete
$inlink = $string . $inlink . '</a>';
[2344] Fix | Delete
[2345] Fix | Delete
$output = str_replace( '%link', $inlink, $format );
[2346] Fix | Delete
}
[2347] Fix | Delete
[2348] Fix | Delete
$adjacent = $previous ? 'previous' : 'next';
[2349] Fix | Delete
[2350] Fix | Delete
/**
[2351] Fix | Delete
* Filters the adjacent post link.
[2352] Fix | Delete
*
[2353] Fix | Delete
* The dynamic portion of the hook name, `$adjacent`, refers to the type
[2354] Fix | Delete
* of adjacency, 'next' or 'previous'.
[2355] Fix | Delete
*
[2356] Fix | Delete
* Possible hook names include:
[2357] Fix | Delete
*
[2358] Fix | Delete
* - `next_post_link`
[2359] Fix | Delete
* - `previous_post_link`
[2360] Fix | Delete
*
[2361] Fix | Delete
* @since 2.6.0
[2362] Fix | Delete
* @since 4.2.0 Added the `$adjacent` parameter.
[2363] Fix | Delete
*
[2364] Fix | Delete
* @param string $output The adjacent post link.
[2365] Fix | Delete
* @param string $format Link anchor format.
[2366] Fix | Delete
* @param string $link Link permalink format.
[2367] Fix | Delete
* @param WP_Post|string $post The adjacent post. Empty string if no corresponding post exists.
[2368] Fix | Delete
* @param string $adjacent Whether the post is previous or next.
[2369] Fix | Delete
*/
[2370] Fix | Delete
return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );
[2371] Fix | Delete
}
[2372] Fix | Delete
[2373] Fix | Delete
/**
[2374] Fix | Delete
* Displays the adjacent post link.
[2375] Fix | Delete
*
[2376] Fix | Delete
* Can be either next post link or previous.
[2377] Fix | Delete
*
[2378] Fix | Delete
* @since 2.5.0
[2379] Fix | Delete
*
[2380] Fix | Delete
* @param string $format Link anchor format.
[2381] Fix | Delete
* @param string $link Link permalink format.
[2382] Fix | Delete
* @param bool $in_same_term Optional. Whether link should be in the same taxonomy term.
[2383] Fix | Delete
* Default false.
[2384] Fix | Delete
* @param int[]|string $excluded_terms Optional. Array or comma-separated list of excluded category IDs.
[2385] Fix | Delete
* Default empty.
[2386] Fix | Delete
* @param bool $previous Optional. Whether to display link to previous or next post.
[2387] Fix | Delete
* Default true.
[2388] Fix | Delete
* @param string $taxonomy Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.
[2389] Fix | Delete
*/
[2390] Fix | Delete
function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
[2391] Fix | Delete
echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
[2392] Fix | Delete
}
[2393] Fix | Delete
[2394] Fix | Delete
/**
[2395] Fix | Delete
* Retrieves the link for a page number.
[2396] Fix | Delete
*
[2397] Fix | Delete
* @since 1.5.0
[2398] Fix | Delete
*
[2399] Fix | Delete
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
[2400] Fix | Delete
*
[2401] Fix | Delete
* @param int $pagenum Optional. Page number. Default 1.
[2402] Fix | Delete
* @param bool $escape Optional. Whether to escape the URL for display, with esc_url().
[2403] Fix | Delete
* If set to false, prepares the URL with sanitize_url(). Default true.
[2404] Fix | Delete
* @return string The link URL for the given page number.
[2405] Fix | Delete
*/
[2406] Fix | Delete
function get_pagenum_link( $pagenum = 1, $escape = true ) {
[2407] Fix | Delete
global $wp_rewrite;
[2408] Fix | Delete
[2409] Fix | Delete
$pagenum = (int) $pagenum;
[2410] Fix | Delete
[2411] Fix | Delete
$request = remove_query_arg( 'paged' );
[2412] Fix | Delete
[2413] Fix | Delete
$home_root = parse_url( home_url() );
[2414] Fix | Delete
$home_root = ( isset( $home_root['path'] ) ) ? $home_root['path'] : '';
[2415] Fix | Delete
$home_root = preg_quote( $home_root, '|' );
[2416] Fix | Delete
[2417] Fix | Delete
$request = preg_replace( '|^' . $home_root . '|i', '', $request );
[2418] Fix | Delete
$request = preg_replace( '|^/+|', '', $request );
[2419] Fix | Delete
[2420] Fix | Delete
if ( ! $wp_rewrite->using_permalinks() || is_admin() ) {
[2421] Fix | Delete
$base = trailingslashit( get_bloginfo( 'url' ) );
[2422] Fix | Delete
[2423] Fix | Delete
if ( $pagenum > 1 ) {
[2424] Fix | Delete
$result = add_query_arg( 'paged', $pagenum, $base . $request );
[2425] Fix | Delete
} else {
[2426] Fix | Delete
$result = $base . $request;
[2427] Fix | Delete
}
[2428] Fix | Delete
} else {
[2429] Fix | Delete
$qs_regex = '|\?.*?$|';
[2430] Fix | Delete
preg_match( $qs_regex, $request, $qs_match );
[2431] Fix | Delete
[2432] Fix | Delete
$parts = array();
[2433] Fix | Delete
$parts[] = untrailingslashit( get_bloginfo( 'url' ) );
[2434] Fix | Delete
[2435] Fix | Delete
if ( ! empty( $qs_match[0] ) ) {
[2436] Fix | Delete
$query_string = $qs_match[0];
[2437] Fix | Delete
$request = preg_replace( $qs_regex, '', $request );
[2438] Fix | Delete
} else {
[2439] Fix | Delete
$query_string = '';
[2440] Fix | Delete
}
[2441] Fix | Delete
[2442] Fix | Delete
$request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request );
[2443] Fix | Delete
$request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request );
[2444] Fix | Delete
$request = ltrim( $request, '/' );
[2445] Fix | Delete
[2446] Fix | Delete
if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' !== $request ) ) {
[2447] Fix | Delete
$parts[] = $wp_rewrite->index;
[2448] Fix | Delete
}
[2449] Fix | Delete
[2450] Fix | Delete
$parts[] = untrailingslashit( $request );
[2451] Fix | Delete
[2452] Fix | Delete
if ( $pagenum > 1 ) {
[2453] Fix | Delete
$parts[] = $wp_rewrite->pagination_base;
[2454] Fix | Delete
$parts[] = $pagenum;
[2455] Fix | Delete
}
[2456] Fix | Delete
[2457] Fix | Delete
$result = user_trailingslashit( implode( '/', array_filter( $parts ) ), 'paged' );
[2458] Fix | Delete
if ( ! empty( $query_string ) ) {
[2459] Fix | Delete
$result .= $query_string;
[2460] Fix | Delete
}
[2461] Fix | Delete
}
[2462] Fix | Delete
[2463] Fix | Delete
/**
[2464] Fix | Delete
* Filters the page number link for the current request.
[2465] Fix | Delete
*
[2466] Fix | Delete
* @since 2.5.0
[2467] Fix | Delete
* @since 5.2.0 Added the `$pagenum` argument.
[2468] Fix | Delete
*
[2469] Fix | Delete
* @param string $result The page number link.
[2470] Fix | Delete
* @param int $pagenum The page number.
[2471] Fix | Delete
*/
[2472] Fix | Delete
$result = apply_filters( 'get_pagenum_link', $result, $pagenum );
[2473] Fix | Delete
[2474] Fix | Delete
if ( $escape ) {
[2475] Fix | Delete
return esc_url( $result );
[2476] Fix | Delete
} else {
[2477] Fix | Delete
return sanitize_url( $result );
[2478] Fix | Delete
}
[2479] Fix | Delete
}
[2480] Fix | Delete
[2481] Fix | Delete
/**
[2482] Fix | Delete
* Retrieves the next posts page link.
[2483] Fix | Delete
*
[2484] Fix | Delete
* Backported from 2.1.3 to 2.0.10.
[2485] Fix | Delete
*
[2486] Fix | Delete
* @since 2.0.10
[2487] Fix | Delete
*
[2488] Fix | Delete
* @global int $paged
[2489] Fix | Delete
*
[2490] Fix | Delete
* @param int $max_page Optional. Max pages. Default 0.
[2491] Fix | Delete
* @return string|void The link URL for next posts page.
[2492] Fix | Delete
*/
[2493] Fix | Delete
function get_next_posts_page_link( $max_page = 0 ) {
[2494] Fix | Delete
global $paged;
[2495] Fix | Delete
[2496] Fix | Delete
if ( ! is_single() ) {
[2497] Fix | Delete
if ( ! $paged ) {
[2498] Fix | Delete
$paged = 1;
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function