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
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/accelera.../componen.../breadcru...
File: breadcrumb.php
<?php
[0] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[1] Fix | Delete
exit;
[2] Fix | Delete
}
[3] Fix | Delete
function amp_breadcrumb_output(){
[4] Fix | Delete
global $redux_builder_amp;
[5] Fix | Delete
$home_non_amp = $archive_non_amp = '';
[6] Fix | Delete
if ( false == $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
[7] Fix | Delete
$home_non_amp = 'nonamp';
[8] Fix | Delete
}
[9] Fix | Delete
if ( false == $redux_builder_amp['ampforwp-archive-support'] ) {
[10] Fix | Delete
$archive_non_amp = 'nonamp';
[11] Fix | Delete
} ?>
[12] Fix | Delete
<?php
[13] Fix | Delete
if ( ampforwp_yoast_breadcrumbs_output() ) {
[14] Fix | Delete
echo '<div class="amp-wp-content breadcrumb">';
[15] Fix | Delete
echo ampforwp_yoast_breadcrumbs_output();
[16] Fix | Delete
echo '</div>';
[17] Fix | Delete
return;
[18] Fix | Delete
}
[19] Fix | Delete
echo '<div class="amp-wp-content breadcrumb">';
[20] Fix | Delete
// Settings
[21] Fix | Delete
$breadcrums_id = 'breadcrumbs';
[22] Fix | Delete
$breadcrums_class = 'breadcrumbs';
[23] Fix | Delete
$home_title = ampforwp_translation($redux_builder_amp['amp-translator-breadcrumbs-homepage-text'] , 'Homepage' );
[24] Fix | Delete
if (function_exists('pll__')) {
[25] Fix | Delete
$home_title = pll__(esc_html__( ampforwp_get_setting('amp-translator-breadcrumbs-homepage-text'), 'accelerated-mobile-pages'));
[26] Fix | Delete
}
[27] Fix | Delete
// If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
[28] Fix | Delete
$custom_taxonomy = 'product_cat';
[29] Fix | Delete
[30] Fix | Delete
// Get the query & post information
[31] Fix | Delete
global $post,$wp_query;
[32] Fix | Delete
// Do not display on the homepage
[33] Fix | Delete
if ( !ampforwp_polylang_front_page() && !is_front_page() ) {
[34] Fix | Delete
[35] Fix | Delete
// Build the breadcrums
[36] Fix | Delete
echo '<ul id="' . esc_attr($breadcrums_id) . '" class="' . esc_attr($breadcrums_class) . '">';
[37] Fix | Delete
$home_url = ampforwp_url_controller( get_home_url('', '/'), $home_non_amp );
[38] Fix | Delete
$home_url = apply_filters('ampforwp_breadcrumbs_home_url',$home_url,$post->ID);
[39] Fix | Delete
// Home page
[40] Fix | Delete
echo '<li class="item-home"><a class="bread-link bread-home" href="' . esc_url($home_url) . '" title="' . esc_attr($home_title) . '">' . esc_html($home_title) . '</a></li>';
[41] Fix | Delete
if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
[42] Fix | Delete
[43] Fix | Delete
[44] Fix | Delete
echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . post_type_archive_title($prefix, false) . '</strong></li>';
[45] Fix | Delete
} else if ( is_author() ) {
[46] Fix | Delete
global $author;
[47] Fix | Delete
[48] Fix | Delete
$userdata = get_userdata( $author );
[49] Fix | Delete
$author_url= get_author_posts_url($userdata->ID);
[50] Fix | Delete
$author_url = trailingslashit($author_url);
[51] Fix | Delete
// Display author name
[52] Fix | Delete
echo '<li class="item-current item-current-' . esc_attr($userdata->user_nicename) . '"><a class="bread-current bread-current-' . esc_attr($userdata->user_nicename) . '" title="' . esc_attr($userdata->display_name) . '" href="'. ampforwp_url_controller( $author_url, $archive_non_amp ). '">' . 'Author: ' . esc_html($userdata->display_name) . '</a></li>';
[53] Fix | Delete
[54] Fix | Delete
} else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
[55] Fix | Delete
[56] Fix | Delete
// If post is a custom post type
[57] Fix | Delete
$post_type = get_post_type();
[58] Fix | Delete
[59] Fix | Delete
// If it is a custom post type display name and link
[60] Fix | Delete
if($post_type != 'post') {
[61] Fix | Delete
[62] Fix | Delete
$post_type_object = get_post_type_object($post_type);
[63] Fix | Delete
$post_type_archive = get_post_type_archive_link($post_type);
[64] Fix | Delete
if ( false != $post_type_archive){
[65] Fix | Delete
echo '<li class="item-cat item-custom-post-type-' . esc_attr($post_type) . '"><a class="bread-cat bread-custom-post-type-' . esc_attr($post_type) . '" href="' .ampforwp_url_controller( $post_type_archive, $archive_non_amp ) . '" title="' . esc_attr($post_type_object->labels->name) . '">' . esc_html($post_type_object->labels->name) . '</a></li>';
[66] Fix | Delete
}
[67] Fix | Delete
else {
[68] Fix | Delete
echo '<li class="item-cat item-custom-post-type-' . esc_attr($post_type) . '"><span class="bread-cat bread-custom-post-type-' . esc_attr($post_type) . '">' . esc_html($post_type_object->labels->name) . '</span></li>';
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
$custom_tax_name = get_queried_object()->name;
[73] Fix | Delete
echo '<li class="item-current item-archive"><strong class="bread-current bread-archive">' . esc_html($custom_tax_name) . '</strong></li>';
[74] Fix | Delete
} else if ( is_single() ) {
[75] Fix | Delete
[76] Fix | Delete
// If post is a custom post type
[77] Fix | Delete
$post_type = get_post_type();
[78] Fix | Delete
[79] Fix | Delete
// If it is a custom post type display name and link
[80] Fix | Delete
if($post_type != 'post') {
[81] Fix | Delete
[82] Fix | Delete
$post_type_object = get_post_type_object($post_type);
[83] Fix | Delete
$post_type_archive = get_post_type_archive_link($post_type);
[84] Fix | Delete
if ( false != $post_type_archive){
[85] Fix | Delete
echo '<li class="item-cat item-custom-post-type-' . esc_attr($post_type) . '"><a class="bread-cat bread-custom-post-type-' . esc_attr($post_type) . '" href="' .ampforwp_url_controller( $post_type_archive, $archive_non_amp ) . '" title="' . esc_attr($post_type_object->labels->name) . '">' . esc_html($post_type_object->labels->name) . '</a></li>';
[86] Fix | Delete
}
[87] Fix | Delete
else {
[88] Fix | Delete
echo '<li class="item-cat item-custom-post-type-' . esc_attr($post_type) . '"><span class="bread-cat bread-custom-post-type-' . esc_attr($post_type) . '">' . esc_html($post_type_object->labels->name) . '</span></li>';
[89] Fix | Delete
}
[90] Fix | Delete
}
[91] Fix | Delete
/*Breadcrumb with tags Start*/
[92] Fix | Delete
$tags_breadcrumbs = '';
[93] Fix | Delete
if(ampforwp_get_setting('ampforwp-bread-crumb-type') == 'tags'){
[94] Fix | Delete
$post_tags = wp_get_post_tags($post->ID);
[95] Fix | Delete
if(!empty($post_tags)){
[96] Fix | Delete
foreach( $post_tags as $post_obj){
[97] Fix | Delete
$tag_name = $post_obj->name;
[98] Fix | Delete
$tag_id = $post_obj->term_id;
[99] Fix | Delete
$tag_name = $post_obj->name;
[100] Fix | Delete
$tag_link = get_tag_link($tag_id);
[101] Fix | Delete
if(ampforwp_get_setting('ampforwp-archive-support-tag') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
[102] Fix | Delete
$tag_link = ampforwp_url_controller( $tag_link );
[103] Fix | Delete
}
[104] Fix | Delete
$tags_breadcrumbs .= '<li class="item-tag item-tag-' . esc_attr($tag_id) . ' item-tag-' . esc_attr($tag_name) . '"><a class="bread-tag bread-tag-' . esc_attr($tag_id) . ' bread-tag-' . esc_attr($tag_name) . '" href="' . esc_url($tag_link) . '" title="' . esc_attr($tag_name) . '">' . esc_html($tag_name) . '</a></li>';
[105] Fix | Delete
}
[106] Fix | Delete
if(ampforwp_get_setting('ampforwp-bread-crumb-post')){
[107] Fix | Delete
if (class_exists('WPSEO_Premium') && !empty(WPSEO_Meta::get_value( 'bctitle', ampforwp_get_the_ID()))) {
[108] Fix | Delete
$bc_title = WPSEO_Meta::get_value( 'bctitle', ampforwp_get_the_ID() );
[109] Fix | Delete
}else{
[110] Fix | Delete
$bc_title = get_the_title(ampforwp_get_the_ID());
[111] Fix | Delete
}
[112] Fix | Delete
$tags_breadcrumbs .='<li class="item-post item-post-' . esc_attr(ampforwp_get_the_ID()) . '"><span class="bread-post">'.wp_kses_data( $bc_title ). '</span></li>';
[113] Fix | Delete
}
[114] Fix | Delete
echo $tags_breadcrumbs; // Escaped above
[115] Fix | Delete
}
[116] Fix | Delete
}
[117] Fix | Delete
if(ampforwp_get_setting('ampforwp-bread-crumb-type') == 'category'){
[118] Fix | Delete
// Get post category info
[119] Fix | Delete
$category = get_the_category();
[120] Fix | Delete
if(!empty($category)) {
[121] Fix | Delete
[122] Fix | Delete
// Get last category post is in
[123] Fix | Delete
$last_category = array_values($category);
[124] Fix | Delete
$last_category = end($last_category);
[125] Fix | Delete
$get_cat_parents = rtrim(get_category_parents($last_category->term_id, false, '>'),'>');
[126] Fix | Delete
if(class_exists( 'WPSEO_Options' )){
[127] Fix | Delete
$primary_cateogory = get_post_meta(ampforwp_get_the_ID(), '_yoast_wpseo_primary_category', true);
[128] Fix | Delete
if(isset($primary_cateogory) && $primary_cateogory!="" && $primary_cateogory > 0){
[129] Fix | Delete
$get_parent_cat = get_category_parents($primary_cateogory, false, '>');
[130] Fix | Delete
if(!is_wp_error($get_parent_cat)){
[131] Fix | Delete
$get_cat_parents = rtrim($get_parent_cat,'>');
[132] Fix | Delete
}
[133] Fix | Delete
}
[134] Fix | Delete
}
[135] Fix | Delete
// Get parent any categories and create array
[136] Fix | Delete
$cat_parents = explode('>',$get_cat_parents);
[137] Fix | Delete
[138] Fix | Delete
// Loop through parent categories and store in variable $cat_display
[139] Fix | Delete
$cat_display = '';
[140] Fix | Delete
if(!empty($cat_parents)){
[141] Fix | Delete
foreach($cat_parents as $parents) {
[142] Fix | Delete
$categories = get_the_category();
[143] Fix | Delete
$cat_id = end($categories)->cat_ID;
[144] Fix | Delete
if(class_exists( 'WPSEO_Options' ) && !empty($primary_cateogory)){
[145] Fix | Delete
$cat_id = $primary_cateogory;
[146] Fix | Delete
}
[147] Fix | Delete
$cat_link = get_category_link($cat_id);
[148] Fix | Delete
if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
[149] Fix | Delete
$cat_link = ampforwp_url_controller( $cat_link );
[150] Fix | Delete
}
[151] Fix | Delete
$cat_link = apply_filters('ampforwp_breadcrumbs_category_url', $cat_link,$post->ID);
[152] Fix | Delete
$parents = apply_filters('ampforwp_breadcrumbs_category_name', $parents);
[153] Fix | Delete
$cat_display .= '<li class="item-cat item-cat-' . esc_attr($cat_id) . '"><a class="bread-cat bread-cat-' . esc_attr($cat_id) . ' bread-cat-' . esc_attr($parents). '" href="'. esc_url($cat_link).'" title="' . esc_attr($parents) . '">' . esc_html($parents) . '</a></li>';
[154] Fix | Delete
}
[155] Fix | Delete
}
[156] Fix | Delete
if(ampforwp_get_setting('ampforwp-bread-crumb-post')){
[157] Fix | Delete
if (class_exists('WPSEO_Premium') && !empty(WPSEO_Meta::get_value( 'bctitle', ampforwp_get_the_ID()))) {
[158] Fix | Delete
$bc_title = WPSEO_Meta::get_value( 'bctitle', ampforwp_get_the_ID() );
[159] Fix | Delete
}else{
[160] Fix | Delete
$bc_title = get_the_title(ampforwp_get_the_ID());
[161] Fix | Delete
}
[162] Fix | Delete
$cat_display .='<li class="item-post item-post-' . esc_attr(ampforwp_get_the_ID()) . '"><span class="bread-post">'.wp_kses_data( $bc_title ). '</span></li>';
[163] Fix | Delete
}
[164] Fix | Delete
}
[165] Fix | Delete
}
[166] Fix | Delete
/*Breadcrumb with tags End*/
[167] Fix | Delete
[168] Fix | Delete
// If it's a custom post type within a custom taxonomy
[169] Fix | Delete
$taxonomy_exists = taxonomy_exists($custom_taxonomy);
[170] Fix | Delete
if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
[171] Fix | Delete
[172] Fix | Delete
$taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
[173] Fix | Delete
if ( $taxonomy_terms ) {
[174] Fix | Delete
$cat_id = $taxonomy_terms[0]->term_id;
[175] Fix | Delete
$cat_nicename = $taxonomy_terms[0]->slug;
[176] Fix | Delete
$cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
[177] Fix | Delete
$cat_link = trailingslashit($cat_link);
[178] Fix | Delete
$cat_name = $taxonomy_terms[0]->name;
[179] Fix | Delete
}
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
// Check if the post is in a category
[183] Fix | Delete
if(!empty($last_category)) {
[184] Fix | Delete
echo $cat_display; // Escaped above
[185] Fix | Delete
[186] Fix | Delete
// Else if post is in a custom taxonomy
[187] Fix | Delete
} else if(!empty($cat_id)) {
[188] Fix | Delete
[189] Fix | Delete
echo '<li class="item-cat item-cat-' . esc_attr($cat_id) . ' item-cat-' . esc_attr($cat_nicename) . '"><a class="bread-cat bread-cat-' . esc_attr($cat_id) . ' bread-cat-' . esc_attr($cat_nicename) . '" href="' . ampforwp_url_controller( $cat_link, $archive_non_amp ) . '" title="' . esc_attr($cat_name) . '">' . esc_html($cat_name) . '</a></li>';
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
} else if ( is_category() ) {
[193] Fix | Delete
[194] Fix | Delete
// Category page
[195] Fix | Delete
echo '<li class="item-current item-cat"><strong class="bread-current bread-cat">' . single_cat_title('', false) . '</strong></li>';
[196] Fix | Delete
} else if ( is_page() ) {
[197] Fix | Delete
[198] Fix | Delete
// Standard page
[199] Fix | Delete
if( $post->post_parent ){
[200] Fix | Delete
[201] Fix | Delete
// If child page, get parents
[202] Fix | Delete
$anc = get_post_ancestors( $post->ID );
[203] Fix | Delete
[204] Fix | Delete
// Get parents in the right order
[205] Fix | Delete
$anc = array_reverse($anc);
[206] Fix | Delete
[207] Fix | Delete
// Parent page loop
[208] Fix | Delete
if ( !isset( $parents ) ) $parents = null;
[209] Fix | Delete
foreach ( $anc as $ancestor ) {
[210] Fix | Delete
$parents .= '<li class="item-parent item-parent-' . esc_attr($ancestor) . '"><a class="bread-parent bread-parent-' . esc_attr($ancestor) . '" href="' . ampforwp_url_controller( get_permalink( $ancestor ), $archive_non_amp ) . '" title="' . esc_attr(get_the_title($ancestor)) . '">' .esc_html( get_the_title($ancestor)) . '</a></li>';
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
// Display parent pages
[214] Fix | Delete
echo $parents; // Escaped above
[215] Fix | Delete
[216] Fix | Delete
// Current page
[217] Fix | Delete
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
} else if ( is_tag() ) {
[221] Fix | Delete
[222] Fix | Delete
// Tag page
[223] Fix | Delete
[224] Fix | Delete
// Get tag information
[225] Fix | Delete
$term_id = get_query_var('tag_id');
[226] Fix | Delete
$taxonomy = 'post_tag';
[227] Fix | Delete
$args = 'include=' . intval($term_id);
[228] Fix | Delete
$terms = get_terms( $taxonomy, $args );
[229] Fix | Delete
$get_term_id = $terms[0]->term_id;
[230] Fix | Delete
$get_term_slug = $terms[0]->slug;
[231] Fix | Delete
$get_term_name = $terms[0]->name;
[232] Fix | Delete
[233] Fix | Delete
// Display the tag name
[234] Fix | Delete
echo '<li class="item-current item-tag-' . esc_attr($get_term_id) . ' item-tag-' . esc_attr($get_term_slug) . '"><strong class="bread-current bread-tag-' . esc_attr($get_term_id) . ' bread-tag-' . esc_attr($get_term_slug) . '">' . esc_html($get_term_name) . '</strong></li>';
[235] Fix | Delete
} elseif ( is_day() ) {
[236] Fix | Delete
[237] Fix | Delete
// Day archive
[238] Fix | Delete
[239] Fix | Delete
// Year link
[240] Fix | Delete
echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . esc_html(ampforwp_translation($redux_builder_amp['amp-translator-archives-text'], 'Archives')) . '</a></li>';
[241] Fix | Delete
[242] Fix | Delete
// Month link
[243] Fix | Delete
echo '<li class="item-month item-month-' . get_the_time('m') . '"><a class="bread-month bread-month-' . get_the_time('m') . '" href="' . get_month_link( get_the_time('Y'), get_the_time('m') ) . '" title="' . get_the_time('M') . '">' . get_the_time('M') . esc_html(ampforwp_translation($redux_builder_amp['amp-translator-archives-text'], 'Archives')) . ' </a></li>';
[244] Fix | Delete
[245] Fix | Delete
[246] Fix | Delete
// Day display
[247] Fix | Delete
echo '<li class="item-current item-' . get_the_time('j') . '"><strong class="bread-current bread-' . get_the_time('j') . '"> ' . get_the_time('jS') . ' ' . get_the_time('M') . esc_html(ampforwp_translation($redux_builder_amp['amp-translator-archives-text'], 'Archives')) . ' </strong></li>';
[248] Fix | Delete
[249] Fix | Delete
} else if ( is_month() ) {
[250] Fix | Delete
[251] Fix | Delete
// Month Archive
[252] Fix | Delete
[253] Fix | Delete
// Year link
[254] Fix | Delete
echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . esc_html(ampforwp_translation($redux_builder_amp['amp-translator-archives-text'], 'Archives')) . ' </a></li>';
[255] Fix | Delete
[256] Fix | Delete
// Month display
[257] Fix | Delete
echo '<li class="item-month item-month-' . get_the_time('m') . '"><strong class="bread-month bread-month-' . get_the_time('m') . '" title="' . get_the_time('M') . '">' . get_the_time('M') . esc_html(ampforwp_translation($redux_builder_amp['amp-translator-archives-text'], 'Archives')) . ' </strong></li>';
[258] Fix | Delete
[259] Fix | Delete
} else if ( is_year() ) {
[260] Fix | Delete
[261] Fix | Delete
// Display year archive
[262] Fix | Delete
echo '<li class="item-current item-current-' . get_the_time('Y') . '"><strong class="bread-current bread-current-' . get_the_time('Y') . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . esc_html(ampforwp_translation($redux_builder_amp['amp-translator-archives-text'], 'Archives')). ' </strong></li>';
[263] Fix | Delete
[264] Fix | Delete
} else if ( get_query_var('paged') ) {
[265] Fix | Delete
[266] Fix | Delete
// Paginated archives
[267] Fix | Delete
echo '<li class="item-current item-current-' . esc_attr(get_query_var('paged')) . '"><strong class="bread-current bread-current-' . esc_attr(get_query_var('paged')) . '" title="Page ' . esc_attr(get_query_var('paged')) . '">'. esc_html(ampforwp_translation($redux_builder_amp['amp-translator-page-text'], 'Page')) . ' ' . esc_html(get_query_var('paged')) . '</strong></li>';
[268] Fix | Delete
[269] Fix | Delete
} else if ( is_search() ) {
[270] Fix | Delete
[271] Fix | Delete
// Search results page
[272] Fix | Delete
echo '<li class="item-current item-current-' . esc_attr(get_search_query()) . '"><strong class="bread-current bread-current-' . esc_attr(get_search_query()) . '" title="Search results for: ' . esc_attr(get_search_query()) . '">
[273] Fix | Delete
' . esc_html(ampforwp_translation($redux_builder_amp['amp-translator-breadcrumbs-search-text'], 'Search results for')) . ': ' . esc_html(get_search_query()) . '</strong></li>';
[274] Fix | Delete
[275] Fix | Delete
}
[276] Fix | Delete
echo '</ul>';
[277] Fix | Delete
[278] Fix | Delete
} ?>
[279] Fix | Delete
</div>
[280] Fix | Delete
<?php }
[281] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function