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/wp-inclu...
File: template.php
[500] Fix | Delete
/**
[501] Fix | Delete
* Retrieves path of search template in current or parent template.
[502] Fix | Delete
*
[503] Fix | Delete
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
[504] Fix | Delete
* and {@see '$type_template'} dynamic hooks, where `$type` is 'search'.
[505] Fix | Delete
*
[506] Fix | Delete
* @since 1.5.0
[507] Fix | Delete
*
[508] Fix | Delete
* @see get_query_template()
[509] Fix | Delete
*
[510] Fix | Delete
* @return string Full path to search template file.
[511] Fix | Delete
*/
[512] Fix | Delete
function get_search_template() {
[513] Fix | Delete
return get_query_template( 'search' );
[514] Fix | Delete
}
[515] Fix | Delete
[516] Fix | Delete
/**
[517] Fix | Delete
* Retrieves path of single template in current or parent template. Applies to single Posts,
[518] Fix | Delete
* single Attachments, and single custom post types.
[519] Fix | Delete
*
[520] Fix | Delete
* The hierarchy for this template looks like:
[521] Fix | Delete
*
[522] Fix | Delete
* 1. {Post Type Template}.php
[523] Fix | Delete
* 2. single-{post_type}-{post_name}.php
[524] Fix | Delete
* 3. single-{post_type}.php
[525] Fix | Delete
* 4. single.php
[526] Fix | Delete
*
[527] Fix | Delete
* An example of this is:
[528] Fix | Delete
*
[529] Fix | Delete
* 1. templates/full-width.php
[530] Fix | Delete
* 2. single-post-hello-world.php
[531] Fix | Delete
* 3. single-post.php
[532] Fix | Delete
* 4. single.php
[533] Fix | Delete
*
[534] Fix | Delete
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
[535] Fix | Delete
* and {@see '$type_template'} dynamic hooks, where `$type` is 'single'.
[536] Fix | Delete
*
[537] Fix | Delete
* @since 1.5.0
[538] Fix | Delete
* @since 4.4.0 `single-{post_type}-{post_name}.php` was added to the top of the template hierarchy.
[539] Fix | Delete
* @since 4.7.0 The decoded form of `single-{post_type}-{post_name}.php` was added to the top of the
[540] Fix | Delete
* template hierarchy when the post name contains multibyte characters.
[541] Fix | Delete
* @since 4.7.0 `{Post Type Template}.php` was added to the top of the template hierarchy.
[542] Fix | Delete
*
[543] Fix | Delete
* @see get_query_template()
[544] Fix | Delete
*
[545] Fix | Delete
* @return string Full path to single template file.
[546] Fix | Delete
*/
[547] Fix | Delete
function get_single_template() {
[548] Fix | Delete
$object = get_queried_object();
[549] Fix | Delete
[550] Fix | Delete
$templates = array();
[551] Fix | Delete
[552] Fix | Delete
if ( ! empty( $object->post_type ) ) {
[553] Fix | Delete
$template = get_page_template_slug( $object );
[554] Fix | Delete
if ( $template && 0 === validate_file( $template ) ) {
[555] Fix | Delete
$templates[] = $template;
[556] Fix | Delete
}
[557] Fix | Delete
[558] Fix | Delete
$name_decoded = urldecode( $object->post_name );
[559] Fix | Delete
if ( $name_decoded !== $object->post_name ) {
[560] Fix | Delete
$templates[] = "single-{$object->post_type}-{$name_decoded}.php";
[561] Fix | Delete
}
[562] Fix | Delete
[563] Fix | Delete
$templates[] = "single-{$object->post_type}-{$object->post_name}.php";
[564] Fix | Delete
$templates[] = "single-{$object->post_type}.php";
[565] Fix | Delete
}
[566] Fix | Delete
[567] Fix | Delete
$templates[] = 'single.php';
[568] Fix | Delete
[569] Fix | Delete
return get_query_template( 'single', $templates );
[570] Fix | Delete
}
[571] Fix | Delete
[572] Fix | Delete
/**
[573] Fix | Delete
* Retrieves an embed template path in the current or parent template.
[574] Fix | Delete
*
[575] Fix | Delete
* The hierarchy for this template looks like:
[576] Fix | Delete
*
[577] Fix | Delete
* 1. embed-{post_type}-{post_format}.php
[578] Fix | Delete
* 2. embed-{post_type}.php
[579] Fix | Delete
* 3. embed.php
[580] Fix | Delete
*
[581] Fix | Delete
* An example of this is:
[582] Fix | Delete
*
[583] Fix | Delete
* 1. embed-post-audio.php
[584] Fix | Delete
* 2. embed-post.php
[585] Fix | Delete
* 3. embed.php
[586] Fix | Delete
*
[587] Fix | Delete
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
[588] Fix | Delete
* and {@see '$type_template'} dynamic hooks, where `$type` is 'embed'.
[589] Fix | Delete
*
[590] Fix | Delete
* @since 4.5.0
[591] Fix | Delete
*
[592] Fix | Delete
* @see get_query_template()
[593] Fix | Delete
*
[594] Fix | Delete
* @return string Full path to embed template file.
[595] Fix | Delete
*/
[596] Fix | Delete
function get_embed_template() {
[597] Fix | Delete
$object = get_queried_object();
[598] Fix | Delete
[599] Fix | Delete
$templates = array();
[600] Fix | Delete
[601] Fix | Delete
if ( ! empty( $object->post_type ) ) {
[602] Fix | Delete
$post_format = get_post_format( $object );
[603] Fix | Delete
if ( $post_format ) {
[604] Fix | Delete
$templates[] = "embed-{$object->post_type}-{$post_format}.php";
[605] Fix | Delete
}
[606] Fix | Delete
$templates[] = "embed-{$object->post_type}.php";
[607] Fix | Delete
}
[608] Fix | Delete
[609] Fix | Delete
$templates[] = 'embed.php';
[610] Fix | Delete
[611] Fix | Delete
return get_query_template( 'embed', $templates );
[612] Fix | Delete
}
[613] Fix | Delete
[614] Fix | Delete
/**
[615] Fix | Delete
* Retrieves the path of the singular template in current or parent template.
[616] Fix | Delete
*
[617] Fix | Delete
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
[618] Fix | Delete
* and {@see '$type_template'} dynamic hooks, where `$type` is 'singular'.
[619] Fix | Delete
*
[620] Fix | Delete
* @since 4.3.0
[621] Fix | Delete
*
[622] Fix | Delete
* @see get_query_template()
[623] Fix | Delete
*
[624] Fix | Delete
* @return string Full path to singular template file
[625] Fix | Delete
*/
[626] Fix | Delete
function get_singular_template() {
[627] Fix | Delete
return get_query_template( 'singular' );
[628] Fix | Delete
}
[629] Fix | Delete
[630] Fix | Delete
/**
[631] Fix | Delete
* Retrieves path of attachment template in current or parent template.
[632] Fix | Delete
*
[633] Fix | Delete
* The hierarchy for this template looks like:
[634] Fix | Delete
*
[635] Fix | Delete
* 1. {mime_type}-{sub_type}.php
[636] Fix | Delete
* 2. {sub_type}.php
[637] Fix | Delete
* 3. {mime_type}.php
[638] Fix | Delete
* 4. attachment.php
[639] Fix | Delete
*
[640] Fix | Delete
* An example of this is:
[641] Fix | Delete
*
[642] Fix | Delete
* 1. image-jpeg.php
[643] Fix | Delete
* 2. jpeg.php
[644] Fix | Delete
* 3. image.php
[645] Fix | Delete
* 4. attachment.php
[646] Fix | Delete
*
[647] Fix | Delete
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
[648] Fix | Delete
* and {@see '$type_template'} dynamic hooks, where `$type` is 'attachment'.
[649] Fix | Delete
*
[650] Fix | Delete
* @since 2.0.0
[651] Fix | Delete
* @since 4.3.0 The order of the mime type logic was reversed so the hierarchy is more logical.
[652] Fix | Delete
*
[653] Fix | Delete
* @see get_query_template()
[654] Fix | Delete
*
[655] Fix | Delete
* @return string Full path to attachment template file.
[656] Fix | Delete
*/
[657] Fix | Delete
function get_attachment_template() {
[658] Fix | Delete
$attachment = get_queried_object();
[659] Fix | Delete
[660] Fix | Delete
$templates = array();
[661] Fix | Delete
[662] Fix | Delete
if ( $attachment ) {
[663] Fix | Delete
if ( str_contains( $attachment->post_mime_type, '/' ) ) {
[664] Fix | Delete
list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
[665] Fix | Delete
} else {
[666] Fix | Delete
list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
[667] Fix | Delete
}
[668] Fix | Delete
[669] Fix | Delete
if ( ! empty( $subtype ) ) {
[670] Fix | Delete
$templates[] = "{$type}-{$subtype}.php";
[671] Fix | Delete
$templates[] = "{$subtype}.php";
[672] Fix | Delete
}
[673] Fix | Delete
$templates[] = "{$type}.php";
[674] Fix | Delete
}
[675] Fix | Delete
$templates[] = 'attachment.php';
[676] Fix | Delete
[677] Fix | Delete
return get_query_template( 'attachment', $templates );
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
/**
[681] Fix | Delete
* Set up the globals used for template loading.
[682] Fix | Delete
*
[683] Fix | Delete
* @since 6.5.0
[684] Fix | Delete
*
[685] Fix | Delete
* @global string $wp_stylesheet_path Path to current theme's stylesheet directory.
[686] Fix | Delete
* @global string $wp_template_path Path to current theme's template directory.
[687] Fix | Delete
*/
[688] Fix | Delete
function wp_set_template_globals() {
[689] Fix | Delete
global $wp_stylesheet_path, $wp_template_path;
[690] Fix | Delete
[691] Fix | Delete
$wp_stylesheet_path = get_stylesheet_directory();
[692] Fix | Delete
$wp_template_path = get_template_directory();
[693] Fix | Delete
}
[694] Fix | Delete
[695] Fix | Delete
/**
[696] Fix | Delete
* Retrieves the name of the highest priority template file that exists.
[697] Fix | Delete
*
[698] Fix | Delete
* Searches in the stylesheet directory before the template directory and
[699] Fix | Delete
* wp-includes/theme-compat so that themes which inherit from a parent theme
[700] Fix | Delete
* can just overload one file.
[701] Fix | Delete
*
[702] Fix | Delete
* @since 2.7.0
[703] Fix | Delete
* @since 5.5.0 The `$args` parameter was added.
[704] Fix | Delete
*
[705] Fix | Delete
* @global string $wp_stylesheet_path Path to current theme's stylesheet directory.
[706] Fix | Delete
* @global string $wp_template_path Path to current theme's template directory.
[707] Fix | Delete
*
[708] Fix | Delete
* @param string|array $template_names Template file(s) to search for, in order.
[709] Fix | Delete
* @param bool $load If true the template file will be loaded if it is found.
[710] Fix | Delete
* @param bool $load_once Whether to require_once or require. Has no effect if `$load` is false.
[711] Fix | Delete
* Default true.
[712] Fix | Delete
* @param array $args Optional. Additional arguments passed to the template.
[713] Fix | Delete
* Default empty array.
[714] Fix | Delete
* @return string The template filename if one is located.
[715] Fix | Delete
*/
[716] Fix | Delete
function locate_template( $template_names, $load = false, $load_once = true, $args = array() ) {
[717] Fix | Delete
global $wp_stylesheet_path, $wp_template_path;
[718] Fix | Delete
[719] Fix | Delete
if ( ! isset( $wp_stylesheet_path ) || ! isset( $wp_template_path ) ) {
[720] Fix | Delete
wp_set_template_globals();
[721] Fix | Delete
}
[722] Fix | Delete
[723] Fix | Delete
$is_child_theme = is_child_theme();
[724] Fix | Delete
[725] Fix | Delete
$located = '';
[726] Fix | Delete
foreach ( (array) $template_names as $template_name ) {
[727] Fix | Delete
if ( ! $template_name ) {
[728] Fix | Delete
continue;
[729] Fix | Delete
}
[730] Fix | Delete
if ( file_exists( $wp_stylesheet_path . '/' . $template_name ) ) {
[731] Fix | Delete
$located = $wp_stylesheet_path . '/' . $template_name;
[732] Fix | Delete
break;
[733] Fix | Delete
} elseif ( $is_child_theme && file_exists( $wp_template_path . '/' . $template_name ) ) {
[734] Fix | Delete
$located = $wp_template_path . '/' . $template_name;
[735] Fix | Delete
break;
[736] Fix | Delete
} elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
[737] Fix | Delete
$located = ABSPATH . WPINC . '/theme-compat/' . $template_name;
[738] Fix | Delete
break;
[739] Fix | Delete
}
[740] Fix | Delete
}
[741] Fix | Delete
[742] Fix | Delete
if ( $load && '' !== $located ) {
[743] Fix | Delete
load_template( $located, $load_once, $args );
[744] Fix | Delete
}
[745] Fix | Delete
[746] Fix | Delete
return $located;
[747] Fix | Delete
}
[748] Fix | Delete
[749] Fix | Delete
/**
[750] Fix | Delete
* Requires the template file with WordPress environment.
[751] Fix | Delete
*
[752] Fix | Delete
* The globals are set up for the template file to ensure that the WordPress
[753] Fix | Delete
* environment is available from within the function. The query variables are
[754] Fix | Delete
* also available.
[755] Fix | Delete
*
[756] Fix | Delete
* @since 1.5.0
[757] Fix | Delete
* @since 5.5.0 The `$args` parameter was added.
[758] Fix | Delete
*
[759] Fix | Delete
* @global array $posts
[760] Fix | Delete
* @global WP_Post $post Global post object.
[761] Fix | Delete
* @global bool $wp_did_header
[762] Fix | Delete
* @global WP_Query $wp_query WordPress Query object.
[763] Fix | Delete
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
[764] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[765] Fix | Delete
* @global string $wp_version
[766] Fix | Delete
* @global WP $wp Current WordPress environment instance.
[767] Fix | Delete
* @global int $id
[768] Fix | Delete
* @global WP_Comment $comment Global comment object.
[769] Fix | Delete
* @global int $user_ID
[770] Fix | Delete
*
[771] Fix | Delete
* @param string $_template_file Path to template file.
[772] Fix | Delete
* @param bool $load_once Whether to require_once or require. Default true.
[773] Fix | Delete
* @param array $args Optional. Additional arguments passed to the template.
[774] Fix | Delete
* Default empty array.
[775] Fix | Delete
*/
[776] Fix | Delete
function load_template( $_template_file, $load_once = true, $args = array() ) {
[777] Fix | Delete
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
[778] Fix | Delete
[779] Fix | Delete
if ( is_array( $wp_query->query_vars ) ) {
[780] Fix | Delete
/*
[781] Fix | Delete
* This use of extract() cannot be removed. There are many possible ways that
[782] Fix | Delete
* templates could depend on variables that it creates existing, and no way to
[783] Fix | Delete
* detect and deprecate it.
[784] Fix | Delete
*
[785] Fix | Delete
* Passing the EXTR_SKIP flag is the safest option, ensuring globals and
[786] Fix | Delete
* function variables cannot be overwritten.
[787] Fix | Delete
*/
[788] Fix | Delete
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
[789] Fix | Delete
extract( $wp_query->query_vars, EXTR_SKIP );
[790] Fix | Delete
}
[791] Fix | Delete
[792] Fix | Delete
if ( isset( $s ) ) {
[793] Fix | Delete
$s = esc_attr( $s );
[794] Fix | Delete
}
[795] Fix | Delete
[796] Fix | Delete
/**
[797] Fix | Delete
* Fires before a template file is loaded.
[798] Fix | Delete
*
[799] Fix | Delete
* @since 6.1.0
[800] Fix | Delete
*
[801] Fix | Delete
* @param string $_template_file The full path to the template file.
[802] Fix | Delete
* @param bool $load_once Whether to require_once or require.
[803] Fix | Delete
* @param array $args Additional arguments passed to the template.
[804] Fix | Delete
*/
[805] Fix | Delete
do_action( 'wp_before_load_template', $_template_file, $load_once, $args );
[806] Fix | Delete
[807] Fix | Delete
if ( $load_once ) {
[808] Fix | Delete
require_once $_template_file;
[809] Fix | Delete
} else {
[810] Fix | Delete
require $_template_file;
[811] Fix | Delete
}
[812] Fix | Delete
[813] Fix | Delete
/**
[814] Fix | Delete
* Fires after a template file is loaded.
[815] Fix | Delete
*
[816] Fix | Delete
* @since 6.1.0
[817] Fix | Delete
*
[818] Fix | Delete
* @param string $_template_file The full path to the template file.
[819] Fix | Delete
* @param bool $load_once Whether to require_once or require.
[820] Fix | Delete
* @param array $args Additional arguments passed to the template.
[821] Fix | Delete
*/
[822] Fix | Delete
do_action( 'wp_after_load_template', $_template_file, $load_once, $args );
[823] Fix | Delete
}
[824] Fix | Delete
[825] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function