I've changed my functions.php file adding a new taxonomy called "autor". Here the code:
add_action( 'init', 'create_autor_nonhierarchical_taxonomy', 0 ); function create_autor_nonhierarchical_taxonomy() {
// Labels part for the GUI
$labels = array(
'name' => _x( 'Autor', 'taxonomy general name' ),
'singular_name' => _x( 'Autor', 'taxonomy singular name' ),
'search_items' => __( 'Buscar autores' ),
'popular_items' => __( 'Autores populares' ),
'all_items' => __( 'Todos los autores' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Editar autor' ),
'update_item' => __( 'Actualizar autor' ),
'add_new_item' => __( 'Añadir nuevo autor' ),
'new_item_name' => __( 'Nombre del nuevo autor' ),
'separate_items_with_commas' => __( 'Separa los autores con comas' ),
'add_or_remove_items' => __( 'Añadir o eliminar autores' ),
'choose_from_most_used' => __( 'Elije ente los autores más utilizados' ),
'menu_name' => __( 'Autor' ),
);
// Now register the non-hierarchical taxonomy like tag
register_taxonomy('autor','product',array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'autor' ),
));
}
add_action( 'woocommerce_single_product_summary', 'show_product_autor', 24 );
function show_product_autor(){
the_terms( $post->ID, 'autor', '<b>AUTOR: </b>', ', ', '<br />' );
}
Everything works perfectly but I'd like that the link that appears in the author's name would redirect to the author page (team plugin) and not to the shop page. How could I edit my code in order to links my taxonomy to the team page? For instance, in this page https://www.editorialufv.es/catalogo/territory-inhabited/ if you click on the name of the author, Elena Farini, you'll be redirect to his books (in this case only one) and not to his team page:https://www.editorialufv.es/team/elena-farini/