Edit File by line
/home/zeestwma/ceyloniy.../wp-inclu...
File: general-template.php
* @param int $size Optional. Size of the site icon. Default 512 (pixels).
[1000] Fix | Delete
* @param string $url Optional. Fallback url if no site icon is found. Default empty.
[1001] Fix | Delete
* @param int $blog_id Optional. ID of the blog to get the site icon for. Default current blog.
[1002] Fix | Delete
*/
[1003] Fix | Delete
function site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
[1004] Fix | Delete
echo esc_url( get_site_icon_url( $size, $url, $blog_id ) );
[1005] Fix | Delete
}
[1006] Fix | Delete
[1007] Fix | Delete
/**
[1008] Fix | Delete
* Determines whether the site has a Site Icon.
[1009] Fix | Delete
*
[1010] Fix | Delete
* @since 4.3.0
[1011] Fix | Delete
*
[1012] Fix | Delete
* @param int $blog_id Optional. ID of the blog in question. Default current blog.
[1013] Fix | Delete
* @return bool Whether the site has a site icon or not.
[1014] Fix | Delete
*/
[1015] Fix | Delete
function has_site_icon( $blog_id = 0 ) {
[1016] Fix | Delete
return (bool) get_site_icon_url( 512, '', $blog_id );
[1017] Fix | Delete
}
[1018] Fix | Delete
[1019] Fix | Delete
/**
[1020] Fix | Delete
* Determines whether the site has a custom logo.
[1021] Fix | Delete
*
[1022] Fix | Delete
* @since 4.5.0
[1023] Fix | Delete
*
[1024] Fix | Delete
* @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
[1025] Fix | Delete
* @return bool Whether the site has a custom logo or not.
[1026] Fix | Delete
*/
[1027] Fix | Delete
function has_custom_logo( $blog_id = 0 ) {
[1028] Fix | Delete
$switched_blog = false;
[1029] Fix | Delete
[1030] Fix | Delete
if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) {
[1031] Fix | Delete
switch_to_blog( $blog_id );
[1032] Fix | Delete
$switched_blog = true;
[1033] Fix | Delete
}
[1034] Fix | Delete
[1035] Fix | Delete
$custom_logo_id = get_theme_mod( 'custom_logo' );
[1036] Fix | Delete
$is_image = ( $custom_logo_id ) ? wp_attachment_is_image( $custom_logo_id ) : false;
[1037] Fix | Delete
[1038] Fix | Delete
if ( $switched_blog ) {
[1039] Fix | Delete
restore_current_blog();
[1040] Fix | Delete
}
[1041] Fix | Delete
[1042] Fix | Delete
return $is_image;
[1043] Fix | Delete
}
[1044] Fix | Delete
[1045] Fix | Delete
/**
[1046] Fix | Delete
* Returns a custom logo, linked to home unless the theme supports removing the link on the home page.
[1047] Fix | Delete
*
[1048] Fix | Delete
* @since 4.5.0
[1049] Fix | Delete
* @since 5.5.0 Added option to remove the link on the home page with `unlink-homepage-logo` theme support
[1050] Fix | Delete
* for the `custom-logo` theme feature.
[1051] Fix | Delete
* @since 5.5.1 Disabled lazy-loading by default.
[1052] Fix | Delete
*
[1053] Fix | Delete
* @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
[1054] Fix | Delete
* @return string Custom logo markup.
[1055] Fix | Delete
*/
[1056] Fix | Delete
function get_custom_logo( $blog_id = 0 ) {
[1057] Fix | Delete
$html = '';
[1058] Fix | Delete
$switched_blog = false;
[1059] Fix | Delete
[1060] Fix | Delete
if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) {
[1061] Fix | Delete
switch_to_blog( $blog_id );
[1062] Fix | Delete
$switched_blog = true;
[1063] Fix | Delete
}
[1064] Fix | Delete
[1065] Fix | Delete
// We have a logo. Logo is go.
[1066] Fix | Delete
if ( has_custom_logo() ) {
[1067] Fix | Delete
$custom_logo_id = get_theme_mod( 'custom_logo' );
[1068] Fix | Delete
$custom_logo_attr = array(
[1069] Fix | Delete
'class' => 'custom-logo',
[1070] Fix | Delete
'loading' => false,
[1071] Fix | Delete
);
[1072] Fix | Delete
[1073] Fix | Delete
$unlink_homepage_logo = (bool) get_theme_support( 'custom-logo', 'unlink-homepage-logo' );
[1074] Fix | Delete
[1075] Fix | Delete
if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) {
[1076] Fix | Delete
/*
[1077] Fix | Delete
* If on the home page, set the logo alt attribute to an empty string,
[1078] Fix | Delete
* as the image is decorative and doesn't need its purpose to be described.
[1079] Fix | Delete
*/
[1080] Fix | Delete
$custom_logo_attr['alt'] = '';
[1081] Fix | Delete
} else {
[1082] Fix | Delete
/*
[1083] Fix | Delete
* If the logo alt attribute is empty, get the site title and explicitly pass it
[1084] Fix | Delete
* to the attributes used by wp_get_attachment_image().
[1085] Fix | Delete
*/
[1086] Fix | Delete
$image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
[1087] Fix | Delete
if ( empty( $image_alt ) ) {
[1088] Fix | Delete
$custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
[1089] Fix | Delete
}
[1090] Fix | Delete
}
[1091] Fix | Delete
[1092] Fix | Delete
/**
[1093] Fix | Delete
* Filters the list of custom logo image attributes.
[1094] Fix | Delete
*
[1095] Fix | Delete
* @since 5.5.0
[1096] Fix | Delete
*
[1097] Fix | Delete
* @param array $custom_logo_attr Custom logo image attributes.
[1098] Fix | Delete
* @param int $custom_logo_id Custom logo attachment ID.
[1099] Fix | Delete
* @param int $blog_id ID of the blog to get the custom logo for.
[1100] Fix | Delete
*/
[1101] Fix | Delete
$custom_logo_attr = apply_filters( 'get_custom_logo_image_attributes', $custom_logo_attr, $custom_logo_id, $blog_id );
[1102] Fix | Delete
[1103] Fix | Delete
/*
[1104] Fix | Delete
* If the alt attribute is not empty, there's no need to explicitly pass it
[1105] Fix | Delete
* because wp_get_attachment_image() already adds the alt attribute.
[1106] Fix | Delete
*/
[1107] Fix | Delete
$image = wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr );
[1108] Fix | Delete
[1109] Fix | Delete
// Check that we have a proper HTML img element.
[1110] Fix | Delete
if ( $image ) {
[1111] Fix | Delete
[1112] Fix | Delete
if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) {
[1113] Fix | Delete
// If on the home page, don't link the logo to home.
[1114] Fix | Delete
$html = sprintf(
[1115] Fix | Delete
'<span class="custom-logo-link">%1$s</span>',
[1116] Fix | Delete
$image
[1117] Fix | Delete
);
[1118] Fix | Delete
} else {
[1119] Fix | Delete
$aria_current = ! is_paged() && ( is_front_page() || is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ? ' aria-current="page"' : '';
[1120] Fix | Delete
[1121] Fix | Delete
$html = sprintf(
[1122] Fix | Delete
'<a href="%1$s" class="custom-logo-link" rel="home"%2$s>%3$s</a>',
[1123] Fix | Delete
esc_url( home_url( '/' ) ),
[1124] Fix | Delete
$aria_current,
[1125] Fix | Delete
$image
[1126] Fix | Delete
);
[1127] Fix | Delete
}
[1128] Fix | Delete
}
[1129] Fix | Delete
} elseif ( is_customize_preview() ) {
[1130] Fix | Delete
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
[1131] Fix | Delete
$html = sprintf(
[1132] Fix | Delete
'<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" alt="" /></a>',
[1133] Fix | Delete
esc_url( home_url( '/' ) )
[1134] Fix | Delete
);
[1135] Fix | Delete
}
[1136] Fix | Delete
[1137] Fix | Delete
if ( $switched_blog ) {
[1138] Fix | Delete
restore_current_blog();
[1139] Fix | Delete
}
[1140] Fix | Delete
[1141] Fix | Delete
/**
[1142] Fix | Delete
* Filters the custom logo output.
[1143] Fix | Delete
*
[1144] Fix | Delete
* @since 4.5.0
[1145] Fix | Delete
* @since 4.6.0 Added the `$blog_id` parameter.
[1146] Fix | Delete
*
[1147] Fix | Delete
* @param string $html Custom logo HTML output.
[1148] Fix | Delete
* @param int $blog_id ID of the blog to get the custom logo for.
[1149] Fix | Delete
*/
[1150] Fix | Delete
return apply_filters( 'get_custom_logo', $html, $blog_id );
[1151] Fix | Delete
}
[1152] Fix | Delete
[1153] Fix | Delete
/**
[1154] Fix | Delete
* Displays a custom logo, linked to home unless the theme supports removing the link on the home page.
[1155] Fix | Delete
*
[1156] Fix | Delete
* @since 4.5.0
[1157] Fix | Delete
*
[1158] Fix | Delete
* @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
[1159] Fix | Delete
*/
[1160] Fix | Delete
function the_custom_logo( $blog_id = 0 ) {
[1161] Fix | Delete
echo get_custom_logo( $blog_id );
[1162] Fix | Delete
}
[1163] Fix | Delete
[1164] Fix | Delete
/**
[1165] Fix | Delete
* Returns document title for the current page.
[1166] Fix | Delete
*
[1167] Fix | Delete
* @since 4.4.0
[1168] Fix | Delete
*
[1169] Fix | Delete
* @global int $page Page number of a single post.
[1170] Fix | Delete
* @global int $paged Page number of a list of posts.
[1171] Fix | Delete
*
[1172] Fix | Delete
* @return string Tag with the document title.
[1173] Fix | Delete
*/
[1174] Fix | Delete
function wp_get_document_title() {
[1175] Fix | Delete
[1176] Fix | Delete
/**
[1177] Fix | Delete
* Filters the document title before it is generated.
[1178] Fix | Delete
*
[1179] Fix | Delete
* Passing a non-empty value will short-circuit wp_get_document_title(),
[1180] Fix | Delete
* returning that value instead.
[1181] Fix | Delete
*
[1182] Fix | Delete
* @since 4.4.0
[1183] Fix | Delete
*
[1184] Fix | Delete
* @param string $title The document title. Default empty string.
[1185] Fix | Delete
*/
[1186] Fix | Delete
$title = apply_filters( 'pre_get_document_title', '' );
[1187] Fix | Delete
if ( ! empty( $title ) ) {
[1188] Fix | Delete
return $title;
[1189] Fix | Delete
}
[1190] Fix | Delete
[1191] Fix | Delete
global $page, $paged;
[1192] Fix | Delete
[1193] Fix | Delete
$title = array(
[1194] Fix | Delete
'title' => '',
[1195] Fix | Delete
);
[1196] Fix | Delete
[1197] Fix | Delete
// If it's a 404 page, use a "Page not found" title.
[1198] Fix | Delete
if ( is_404() ) {
[1199] Fix | Delete
$title['title'] = __( 'Page not found' );
[1200] Fix | Delete
[1201] Fix | Delete
// If it's a search, use a dynamic search results title.
[1202] Fix | Delete
} elseif ( is_search() ) {
[1203] Fix | Delete
/* translators: %s: Search query. */
[1204] Fix | Delete
$title['title'] = sprintf( __( 'Search Results for &#8220;%s&#8221;' ), get_search_query() );
[1205] Fix | Delete
[1206] Fix | Delete
// If on the front page, use the site title.
[1207] Fix | Delete
} elseif ( is_front_page() ) {
[1208] Fix | Delete
$title['title'] = get_bloginfo( 'name', 'display' );
[1209] Fix | Delete
[1210] Fix | Delete
// If on a post type archive, use the post type archive title.
[1211] Fix | Delete
} elseif ( is_post_type_archive() ) {
[1212] Fix | Delete
$title['title'] = post_type_archive_title( '', false );
[1213] Fix | Delete
[1214] Fix | Delete
// If on a taxonomy archive, use the term title.
[1215] Fix | Delete
} elseif ( is_tax() ) {
[1216] Fix | Delete
$title['title'] = single_term_title( '', false );
[1217] Fix | Delete
[1218] Fix | Delete
/*
[1219] Fix | Delete
* If we're on the blog page that is not the homepage
[1220] Fix | Delete
* or a single post of any post type, use the post title.
[1221] Fix | Delete
*/
[1222] Fix | Delete
} elseif ( is_home() || is_singular() ) {
[1223] Fix | Delete
$title['title'] = single_post_title( '', false );
[1224] Fix | Delete
[1225] Fix | Delete
// If on a category or tag archive, use the term title.
[1226] Fix | Delete
} elseif ( is_category() || is_tag() ) {
[1227] Fix | Delete
$title['title'] = single_term_title( '', false );
[1228] Fix | Delete
[1229] Fix | Delete
// If on an author archive, use the author's display name.
[1230] Fix | Delete
} elseif ( is_author() && get_queried_object() ) {
[1231] Fix | Delete
$author = get_queried_object();
[1232] Fix | Delete
$title['title'] = $author->display_name;
[1233] Fix | Delete
[1234] Fix | Delete
// If it's a date archive, use the date as the title.
[1235] Fix | Delete
} elseif ( is_year() ) {
[1236] Fix | Delete
$title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) );
[1237] Fix | Delete
[1238] Fix | Delete
} elseif ( is_month() ) {
[1239] Fix | Delete
$title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) );
[1240] Fix | Delete
[1241] Fix | Delete
} elseif ( is_day() ) {
[1242] Fix | Delete
$title['title'] = get_the_date();
[1243] Fix | Delete
}
[1244] Fix | Delete
[1245] Fix | Delete
// Add a page number if necessary.
[1246] Fix | Delete
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
[1247] Fix | Delete
/* translators: %s: Page number. */
[1248] Fix | Delete
$title['page'] = sprintf( __( 'Page %s' ), max( $paged, $page ) );
[1249] Fix | Delete
}
[1250] Fix | Delete
[1251] Fix | Delete
// Append the description or site title to give context.
[1252] Fix | Delete
if ( is_front_page() ) {
[1253] Fix | Delete
$title['tagline'] = get_bloginfo( 'description', 'display' );
[1254] Fix | Delete
} else {
[1255] Fix | Delete
$title['site'] = get_bloginfo( 'name', 'display' );
[1256] Fix | Delete
}
[1257] Fix | Delete
[1258] Fix | Delete
/**
[1259] Fix | Delete
* Filters the separator for the document title.
[1260] Fix | Delete
*
[1261] Fix | Delete
* @since 4.4.0
[1262] Fix | Delete
*
[1263] Fix | Delete
* @param string $sep Document title separator. Default '-'.
[1264] Fix | Delete
*/
[1265] Fix | Delete
$sep = apply_filters( 'document_title_separator', '-' );
[1266] Fix | Delete
[1267] Fix | Delete
/**
[1268] Fix | Delete
* Filters the parts of the document title.
[1269] Fix | Delete
*
[1270] Fix | Delete
* @since 4.4.0
[1271] Fix | Delete
*
[1272] Fix | Delete
* @param array $title {
[1273] Fix | Delete
* The document title parts.
[1274] Fix | Delete
*
[1275] Fix | Delete
* @type string $title Title of the viewed page.
[1276] Fix | Delete
* @type string $page Optional. Page number if paginated.
[1277] Fix | Delete
* @type string $tagline Optional. Site description when on home page.
[1278] Fix | Delete
* @type string $site Optional. Site title when not on home page.
[1279] Fix | Delete
* }
[1280] Fix | Delete
*/
[1281] Fix | Delete
$title = apply_filters( 'document_title_parts', $title );
[1282] Fix | Delete
[1283] Fix | Delete
$title = implode( " $sep ", array_filter( $title ) );
[1284] Fix | Delete
[1285] Fix | Delete
/**
[1286] Fix | Delete
* Filters the document title.
[1287] Fix | Delete
*
[1288] Fix | Delete
* @since 5.8.0
[1289] Fix | Delete
*
[1290] Fix | Delete
* @param string $title Document title.
[1291] Fix | Delete
*/
[1292] Fix | Delete
$title = apply_filters( 'document_title', $title );
[1293] Fix | Delete
[1294] Fix | Delete
return $title;
[1295] Fix | Delete
}
[1296] Fix | Delete
[1297] Fix | Delete
/**
[1298] Fix | Delete
* Displays title tag with content.
[1299] Fix | Delete
*
[1300] Fix | Delete
* @since 4.1.0
[1301] Fix | Delete
* @since 4.4.0 Improved title output replaced `wp_title()`.
[1302] Fix | Delete
* @access private
[1303] Fix | Delete
*/
[1304] Fix | Delete
function _wp_render_title_tag() {
[1305] Fix | Delete
if ( ! current_theme_supports( 'title-tag' ) ) {
[1306] Fix | Delete
return;
[1307] Fix | Delete
}
[1308] Fix | Delete
[1309] Fix | Delete
echo '<title>' . wp_get_document_title() . '</title>' . "\n";
[1310] Fix | Delete
}
[1311] Fix | Delete
[1312] Fix | Delete
/**
[1313] Fix | Delete
* Displays or retrieves page title for all areas of blog.
[1314] Fix | Delete
*
[1315] Fix | Delete
* By default, the page title will display the separator before the page title,
[1316] Fix | Delete
* so that the blog title will be before the page title. This is not good for
[1317] Fix | Delete
* title display, since the blog title shows up on most tabs and not what is
[1318] Fix | Delete
* important, which is the page that the user is looking at.
[1319] Fix | Delete
*
[1320] Fix | Delete
* There are also SEO benefits to having the blog title after or to the 'right'
[1321] Fix | Delete
* of the page title. However, it is mostly common sense to have the blog title
[1322] Fix | Delete
* to the right with most browsers supporting tabs. You can achieve this by
[1323] Fix | Delete
* using the seplocation parameter and setting the value to 'right'. This change
[1324] Fix | Delete
* was introduced around 2.5.0, in case backward compatibility of themes is
[1325] Fix | Delete
* important.
[1326] Fix | Delete
*
[1327] Fix | Delete
* @since 1.0.0
[1328] Fix | Delete
*
[1329] Fix | Delete
* @global WP_Locale $wp_locale WordPress date and time locale object.
[1330] Fix | Delete
*
[1331] Fix | Delete
* @param string $sep Optional. How to separate the various items within the page title.
[1332] Fix | Delete
* Default '&raquo;'.
[1333] Fix | Delete
* @param bool $display Optional. Whether to display or retrieve title. Default true.
[1334] Fix | Delete
* @param string $seplocation Optional. Location of the separator (either 'left' or 'right').
[1335] Fix | Delete
* @return string|void String when `$display` is false, nothing otherwise.
[1336] Fix | Delete
*/
[1337] Fix | Delete
function wp_title( $sep = '&raquo;', $display = true, $seplocation = '' ) {
[1338] Fix | Delete
global $wp_locale;
[1339] Fix | Delete
[1340] Fix | Delete
$m = get_query_var( 'm' );
[1341] Fix | Delete
$year = get_query_var( 'year' );
[1342] Fix | Delete
$monthnum = get_query_var( 'monthnum' );
[1343] Fix | Delete
$day = get_query_var( 'day' );
[1344] Fix | Delete
$search = get_query_var( 's' );
[1345] Fix | Delete
$title = '';
[1346] Fix | Delete
[1347] Fix | Delete
$t_sep = '%WP_TITLE_SEP%'; // Temporary separator, for accurate flipping, if necessary.
[1348] Fix | Delete
[1349] Fix | Delete
// If there is a post.
[1350] Fix | Delete
if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {
[1351] Fix | Delete
$title = single_post_title( '', false );
[1352] Fix | Delete
}
[1353] Fix | Delete
[1354] Fix | Delete
// If there's a post type archive.
[1355] Fix | Delete
if ( is_post_type_archive() ) {
[1356] Fix | Delete
$post_type = get_query_var( 'post_type' );
[1357] Fix | Delete
if ( is_array( $post_type ) ) {
[1358] Fix | Delete
$post_type = reset( $post_type );
[1359] Fix | Delete
}
[1360] Fix | Delete
$post_type_object = get_post_type_object( $post_type );
[1361] Fix | Delete
if ( ! $post_type_object->has_archive ) {
[1362] Fix | Delete
$title = post_type_archive_title( '', false );
[1363] Fix | Delete
}
[1364] Fix | Delete
}
[1365] Fix | Delete
[1366] Fix | Delete
// If there's a category or tag.
[1367] Fix | Delete
if ( is_category() || is_tag() ) {
[1368] Fix | Delete
$title = single_term_title( '', false );
[1369] Fix | Delete
}
[1370] Fix | Delete
[1371] Fix | Delete
// If there's a taxonomy.
[1372] Fix | Delete
if ( is_tax() ) {
[1373] Fix | Delete
$term = get_queried_object();
[1374] Fix | Delete
if ( $term ) {
[1375] Fix | Delete
$tax = get_taxonomy( $term->taxonomy );
[1376] Fix | Delete
$title = single_term_title( $tax->labels->name . $t_sep, false );
[1377] Fix | Delete
}
[1378] Fix | Delete
}
[1379] Fix | Delete
[1380] Fix | Delete
// If there's an author.
[1381] Fix | Delete
if ( is_author() && ! is_post_type_archive() ) {
[1382] Fix | Delete
$author = get_queried_object();
[1383] Fix | Delete
if ( $author ) {
[1384] Fix | Delete
$title = $author->display_name;
[1385] Fix | Delete
}
[1386] Fix | Delete
}
[1387] Fix | Delete
[1388] Fix | Delete
// Post type archives with has_archive should override terms.
[1389] Fix | Delete
if ( is_post_type_archive() && $post_type_object->has_archive ) {
[1390] Fix | Delete
$title = post_type_archive_title( '', false );
[1391] Fix | Delete
}
[1392] Fix | Delete
[1393] Fix | Delete
// If there's a month.
[1394] Fix | Delete
if ( is_archive() && ! empty( $m ) ) {
[1395] Fix | Delete
$my_year = substr( $m, 0, 4 );
[1396] Fix | Delete
$my_month = substr( $m, 4, 2 );
[1397] Fix | Delete
$my_day = (int) substr( $m, 6, 2 );
[1398] Fix | Delete
$title = $my_year .
[1399] Fix | Delete
( $my_month ? $t_sep . $wp_locale->get_month( $my_month ) : '' ) .
[1400] Fix | Delete
( $my_day ? $t_sep . $my_day : '' );
[1401] Fix | Delete
}
[1402] Fix | Delete
[1403] Fix | Delete
// If there's a year.
[1404] Fix | Delete
if ( is_archive() && ! empty( $year ) ) {
[1405] Fix | Delete
$title = $year;
[1406] Fix | Delete
if ( ! empty( $monthnum ) ) {
[1407] Fix | Delete
$title .= $t_sep . $wp_locale->get_month( $monthnum );
[1408] Fix | Delete
}
[1409] Fix | Delete
if ( ! empty( $day ) ) {
[1410] Fix | Delete
$title .= $t_sep . zeroise( $day, 2 );
[1411] Fix | Delete
}
[1412] Fix | Delete
}
[1413] Fix | Delete
[1414] Fix | Delete
// If it's a search.
[1415] Fix | Delete
if ( is_search() ) {
[1416] Fix | Delete
/* translators: 1: Separator, 2: Search query. */
[1417] Fix | Delete
$title = sprintf( __( 'Search Results %1$s %2$s' ), $t_sep, strip_tags( $search ) );
[1418] Fix | Delete
}
[1419] Fix | Delete
[1420] Fix | Delete
// If it's a 404 page.
[1421] Fix | Delete
if ( is_404() ) {
[1422] Fix | Delete
$title = __( 'Page not found' );
[1423] Fix | Delete
}
[1424] Fix | Delete
[1425] Fix | Delete
if ( ! is_string( $title ) ) {
[1426] Fix | Delete
$title = '';
[1427] Fix | Delete
}
[1428] Fix | Delete
[1429] Fix | Delete
$prefix = '';
[1430] Fix | Delete
$title_array = array();
[1431] Fix | Delete
if ( '' !== $title ) {
[1432] Fix | Delete
$prefix = " $sep ";
[1433] Fix | Delete
$title_array = explode( $t_sep, $title );
[1434] Fix | Delete
}
[1435] Fix | Delete
[1436] Fix | Delete
/**
[1437] Fix | Delete
* Filters the parts of the page title.
[1438] Fix | Delete
*
[1439] Fix | Delete
* @since 4.0.0
[1440] Fix | Delete
*
[1441] Fix | Delete
* @param string[] $title_array Array of parts of the page title.
[1442] Fix | Delete
*/
[1443] Fix | Delete
$title_array = apply_filters( 'wp_title_parts', $title_array );
[1444] Fix | Delete
[1445] Fix | Delete
// Determines position of the separator and direction of the breadcrumb.
[1446] Fix | Delete
if ( 'right' === $seplocation ) { // Separator on right, so reverse the order.
[1447] Fix | Delete
$title_array = array_reverse( $title_array );
[1448] Fix | Delete
$title = implode( " $sep ", $title_array ) . $prefix;
[1449] Fix | Delete
} else {
[1450] Fix | Delete
$title = $prefix . implode( " $sep ", $title_array );
[1451] Fix | Delete
}
[1452] Fix | Delete
[1453] Fix | Delete
/**
[1454] Fix | Delete
* Filters the text of the page title.
[1455] Fix | Delete
*
[1456] Fix | Delete
* @since 2.0.0
[1457] Fix | Delete
*
[1458] Fix | Delete
* @param string $title Page title.
[1459] Fix | Delete
* @param string $sep Title separator.
[1460] Fix | Delete
* @param string $seplocation Location of the separator (either 'left' or 'right').
[1461] Fix | Delete
*/
[1462] Fix | Delete
$title = apply_filters( 'wp_title', $title, $sep, $seplocation );
[1463] Fix | Delete
[1464] Fix | Delete
// Send it out.
[1465] Fix | Delete
if ( $display ) {
[1466] Fix | Delete
echo $title;
[1467] Fix | Delete
} else {
[1468] Fix | Delete
return $title;
[1469] Fix | Delete
}
[1470] Fix | Delete
}
[1471] Fix | Delete
[1472] Fix | Delete
/**
[1473] Fix | Delete
* Displays or retrieves page title for post.
[1474] Fix | Delete
*
[1475] Fix | Delete
* This is optimized for single.php template file for displaying the post title.
[1476] Fix | Delete
*
[1477] Fix | Delete
* It does not support placing the separator after the title, but by leaving the
[1478] Fix | Delete
* prefix parameter empty, you can set the title separator manually. The prefix
[1479] Fix | Delete
* does not automatically place a space between the prefix, so if there should
[1480] Fix | Delete
* be a space, the parameter value will need to have it at the end.
[1481] Fix | Delete
*
[1482] Fix | Delete
* @since 0.71
[1483] Fix | Delete
*
[1484] Fix | Delete
* @param string $prefix Optional. What to display before the title.
[1485] Fix | Delete
* @param bool $display Optional. Whether to display or retrieve title. Default true.
[1486] Fix | Delete
* @return string|void Title when retrieving.
[1487] Fix | Delete
*/
[1488] Fix | Delete
function single_post_title( $prefix = '', $display = true ) {
[1489] Fix | Delete
$_post = get_queried_object();
[1490] Fix | Delete
[1491] Fix | Delete
if ( ! isset( $_post->post_title ) ) {
[1492] Fix | Delete
return;
[1493] Fix | Delete
}
[1494] Fix | Delete
[1495] Fix | Delete
/**
[1496] Fix | Delete
* Filters the page title for a single post.
[1497] Fix | Delete
*
[1498] Fix | Delete
* @since 0.71
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function