Fixes to breadcrumb representation of taxonomies path.
This commit is contained in:
parent
11172a861e
commit
5a6c7978d0
|
@ -242,6 +242,7 @@ function tainacan_include_items_in_search_results( $query ) {
|
||||||
if ( !is_post_type_archive() && isset($_GET['s']) ) {
|
if ( !is_post_type_archive() && isset($_GET['s']) ) {
|
||||||
if ( defined ('TAINACAN_VERSION') &&
|
if ( defined ('TAINACAN_VERSION') &&
|
||||||
$query->get( 'post_type' ) !== 'tainacan-collection' &&
|
$query->get( 'post_type' ) !== 'tainacan-collection' &&
|
||||||
|
$query->get( 'post_type' ) !== 'tainacan-taxonomy' &&
|
||||||
(!isset($_GET['onlyposts']) || !$_GET['onlyposts']) &&
|
(!isset($_GET['onlyposts']) || !$_GET['onlyposts']) &&
|
||||||
(!isset($_GET['onlypages']) || !$_GET['onlypages']) &&
|
(!isset($_GET['onlypages']) || !$_GET['onlypages']) &&
|
||||||
$query->is_main_query() &&
|
$query->is_main_query() &&
|
||||||
|
@ -254,7 +255,7 @@ function tainacan_include_items_in_search_results( $query ) {
|
||||||
if ( !is_array($existing_post_types) )
|
if ( !is_array($existing_post_types) )
|
||||||
$existing_post_types = [ $existing_post_types ];
|
$existing_post_types = [ $existing_post_types ];
|
||||||
|
|
||||||
$query->set( 'post_type', array_merge( $existing_post_types, ['post', 'page', 'tainacan-collection'], $collections_post_types ) );
|
$query->set( 'post_type', array_merge( $existing_post_types, ['post', 'page', 'tainacan-collection', 'tainacan-taxonomy'], $collections_post_types ) );
|
||||||
} else if ( isset($_GET['onlypages']) && $_GET['onlypages'] && $query->is_main_query() && $query->is_search() && ! is_admin() ) {
|
} else if ( isset($_GET['onlypages']) && $_GET['onlypages'] && $query->is_main_query() && $query->is_search() && ! is_admin() ) {
|
||||||
$query->set( 'post_type', 'pages' );
|
$query->set( 'post_type', 'pages' );
|
||||||
} else if ( isset($_GET['onlyposts']) && $_GET['onlyposts'] && $query->is_main_query() && $query->is_search() && ! is_admin() ) {
|
} else if ( isset($_GET['onlyposts']) && $_GET['onlyposts'] && $query->is_main_query() && $query->is_search() && ! is_admin() ) {
|
||||||
|
|
|
@ -25,6 +25,14 @@ function tainacan_theme_collection_title( $title ) {
|
||||||
}
|
}
|
||||||
add_filter( 'get_the_archive_title', 'tainacan_theme_collection_title' );
|
add_filter( 'get_the_archive_title', 'tainacan_theme_collection_title' );
|
||||||
|
|
||||||
|
function tainacan_theme_taxonomy_title( $title ) {
|
||||||
|
if ( is_post_type_archive( 'tainacan-taxononomy' ) ) {
|
||||||
|
return __( 'Taxonomies', 'tainacan-interface' );
|
||||||
|
}
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
add_filter( 'get_the_archive_title', 'tainacan_theme_taxonomy_title' );
|
||||||
|
|
||||||
function tainacan_theme_collection_query( $query ) {
|
function tainacan_theme_collection_query( $query ) {
|
||||||
if ( $query->is_main_query() && $query->is_post_type_archive( 'tainacan-collection' ) ) {
|
if ( $query->is_main_query() && $query->is_post_type_archive( 'tainacan-collection' ) ) {
|
||||||
$query->set( 'posts_per_page', 12 );
|
$query->set( 'posts_per_page', 12 );
|
||||||
|
|
|
@ -43,7 +43,7 @@ function tainacan_interface_the_breadcrumb() {
|
||||||
if ( get_post_type() != 'post' ) {
|
if ( get_post_type() != 'post' ) {
|
||||||
$post_type = get_post_type_object(get_post_type());
|
$post_type = get_post_type_object(get_post_type());
|
||||||
$slug = $post_type->rewrite;
|
$slug = $post_type->rewrite;
|
||||||
if(!is_page() && get_post_type() != 'tainacan-collection') {
|
if (!is_page() && get_post_type() != 'tainacan-collection' && get_post_type() != 'tainacan-taxonomy' ) {
|
||||||
echo '<a href="'. esc_url(get_post_type_archive_link('tainacan-collection')) .'">'; _e( 'Collections', 'tainacan-interface' ); echo '</a> ' . $delimiter . ' ';
|
echo '<a href="'. esc_url(get_post_type_archive_link('tainacan-collection')) .'">'; _e( 'Collections', 'tainacan-interface' ); echo '</a> ' . $delimiter . ' ';
|
||||||
}
|
}
|
||||||
echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a>';
|
echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a>';
|
||||||
|
@ -83,8 +83,8 @@ function tainacan_interface_the_breadcrumb() {
|
||||||
// Display the current term in the breadcrumb
|
// Display the current term in the breadcrumb
|
||||||
echo ' ' . $delimiter . ' ';
|
echo ' ' . $delimiter . ' ';
|
||||||
echo $before . $term->name . $after;
|
echo $before . $term->name . $after;
|
||||||
} elseif(!is_tax() && get_post_type() != 'tainacan-collection') {
|
} elseif( !is_tax() && get_post_type() != 'tainacan-collection' && get_post_type() != 'tainacan-taxonomy' ) {
|
||||||
echo '<a href="'. esc_url(get_post_type_archive_link('tainacan-collection')) .'">';
|
echo '<a href="'. esc_url(get_post_type_archive_link('tainacan-collection') ) .'">';
|
||||||
_e( 'Collections', 'tainacan-interface' );
|
_e( 'Collections', 'tainacan-interface' );
|
||||||
echo '</a> ' . $delimiter . ' ';
|
echo '</a> ' . $delimiter . ' ';
|
||||||
$str = '';
|
$str = '';
|
||||||
|
@ -97,8 +97,10 @@ function tainacan_interface_the_breadcrumb() {
|
||||||
}
|
}
|
||||||
echo $before . $str . $after;
|
echo $before . $str . $after;
|
||||||
} else {
|
} else {
|
||||||
if ( is_archive() ) {
|
if ( is_archive() && get_post_type() == 'tainacan-collection' ) {
|
||||||
$str = __( 'Collections', 'tainacan-interface' ) . ' ';
|
$str = __( 'Collections', 'tainacan-interface' ) . ' ';
|
||||||
|
} else if ( is_archive() && get_post_type() == 'tainacan-taxonomy' ) {
|
||||||
|
$str = __( 'Taxonomies', 'tainacan-interface' ) . ' ';
|
||||||
} else {
|
} else {
|
||||||
$str = $post_type->labels->singular_name;
|
$str = $post_type->labels->singular_name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue