File: wordpress-seo/frontend/class-breadcrumbs.php
Line 164 - 170:
} elseif ( is_404() ) {
if ( isset( $options['breadcrumbs-404crumb'] ) && $options['breadcrumbs-404crumb'] != '' )
$crumb404 = $options['breadcrumbs-404crumb'];
else
$crumb404 = __( 'Error 404: Page not found', 'wordpress-seo' );
$links[] = array( 'text' => $crumb404 );
}
replace with:
} elseif ( is_404() ) {
if ( get_query_var( 'year' ) !== 0 || ( get_query_var( 'monthnum' ) !== 0 || get_query_var( 'day' ) !== 0 ) ) {
if ( "page" == $on_front && !is_home() ) {
if ( $blog_page && ( !isset( $options['breadcrumbs-blog-remove'] ) || !$options['breadcrumbs-blog-remove'] ) )
$links[] = array( 'id' => $blog_page );
}
if ( isset( $options['breadcrumbs-archiveprefix'] ) )
$bc = $options['breadcrumbs-archiveprefix'];
else
$bc = __( 'Archives for', 'wordpress-seo' );
if ( get_query_var( 'day' ) !== 0 ) {
global $wp_locale;
$links[] = array(
'url' => get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) ),
'text' => $wp_locale->get_month( get_query_var( 'monthnum' ) ) . ' ' . get_query_var( 'year' )
);
global $post;
$original_p = $post;
$post->post_date = sprintf("%04d-%02d-%02d 00:00:00", get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
$links[] = array( 'text' => $bc . " " . get_the_date() );
$post = $original_p;
} else if ( get_query_var( 'monthnum' ) !== 0 ) {
$links[] = array( 'text' => $bc . " " . single_month_title( ' ', false ) );
} else if ( get_query_var( 'year' ) !== 0 ) {
$links[] = array( 'text' => $bc . " " . get_query_var( 'year' ) );
}
}
else {
if ( isset( $options['breadcrumbs-404crumb'] ) && $options['breadcrumbs-404crumb'] != '' )
$crumb404 = $options['breadcrumbs-404crumb'];
else
$crumb404 = __( 'Error 404: Page not found', 'wordpress-seo' );
$links[] = array( 'text' => $crumb404 );
}
}
File: wordpress-seo/frontend/class-frontend.php
Line 355-359:
} else if ( is_404() ) {
$title = $this->get_title_from_options( 'title-404' );
if ( empty( $title ) )
$title_part = __( 'Page not found', 'wordpress-seo' );
replace with:
} else if ( is_404() ) {
if ( get_query_var( 'year' ) !== 0 || ( get_query_var( 'monthnum' ) !== 0 || get_query_var( 'day' ) !== 0 ) ) {
if ( get_query_var( 'day' ) !== 0 ) {
global $post;
$original_p = $post;
$post->post_date = sprintf("%04d-%02d-%02d 00:00:00", get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
$title_part = sprintf( __( '%s Archives', 'wordpress-seo' ), get_the_date() );
$post = $original_p;
}
else if ( get_query_var( 'monthnum' ) !== 0 ) {
$title_part = sprintf( __( '%s Archives', 'wordpress-seo' ), single_month_title( ' ', false ) );
}
else if ( get_query_var( 'year' ) !== 0 ) {
$title_part = sprintf( __( '%s Archives', 'wordpress-seo' ), get_query_var( 'year' ) );
}
else {
$title_part = __( 'Archives', 'wordpress-seo' );
}
}
else {
$title = $this->get_title_from_options( 'title-404', array( 'term404' => get_query_var( 'pagename' ) ) );
if ( empty( $title ) )
$title_part = __( 'Page not found', 'wordpress-seo' );
}
File: wordpress-seo/inc/wpseo-functions.php
Line 110-111:
'term_id' => '',
);
replace with:
'term_id' => '',
'term404' => '',
);
Line 173-174:
'%%caption%%' => $r->post_excerpt,
);
replace with:
'%%caption%%' => $r->post_excerpt,
'%%term404%%' => sanitize_text_field ( str_replace( '-', ' ', $r->term404 ) ),
);
File: wordpress-seo/admin/pages/metas.php
Line 298-299:
</tr>
<tr>
replace with:
</tr>
<tr>
<th>%%term404%%</th>
<td>' . __( 'Replaced with the slug which caused the 404', 'wordpress-seo' ) . '</td>
</tr>
<tr>