I'm giving maintenance on a Wordpress site where there is a page called "Services" and so there is also the "Services Category", on certain page of the site, these services are listed within each category.
I'm trying to add a new field to "Service Category", the "sorting" so that the customer can choose the order in which the categories and their services will be listed in the format 0 for first, 1 for second and so on.
Well, I saw that a Taxonomy was created for this page but I can not get the additional field I want displayed. Here is the taxonomy code:
function taxonomiaCategoriaServico() {
$rotulosCategoriaServico = array(
'name' => 'Categorias de Servico',
'singular_name' => 'Categoria de Servico',
'search_items' => 'Buscar categorias de Servico',
'all_items' => 'Todas categorias de Servico',
'parent_item' => 'Categoria de Servico pai',
'parent_item_colon' => 'Categoria de Servico pai:',
'edit_item' => 'Editar categoria de Servico',
'update_item' => 'Atualizar categoria de Servico',
'add_new_item' => 'Nova categoria de Servico',
'new_item_name' => 'Nova categoria',
'menu_name' => 'Categorias de Servico',
);
$argsCategoriaServico = array(
'hierarchical' => true,
'labels' => $rotulosCategoriaServico,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'categoria-servico' ),
);
register_taxonomy( 'categoriaServico', array( 'servico' ), $argsCategoriaServico );
}
I have tried to put everything inside the label, I already saw the documentation in the codex in the page of Wordpress and I could not.
Here's how I call the template to show the information.
<?php
$conteudoTaxonomias = get_terms( 'categoriaServico', '' );
foreach ($conteudoTaxonomias as $conteudoTaxonomia):
$foto = $conteudoTaxonomia->description; ?>
<div class="col-md-6 serv" style="background: url(<?php echo "$foto"; ?>) no-repeat;">
<div class="lente" id="diminuir1">
</div>
<div class="conteudo">
<h3><i class="fa fa-check-circle" aria-hidden="true"></i> <?php echo $conteudoTaxonomia->name;?></h3>
<ul>
<?php
$servicos = new WP_Query(array(
'post_type' => 'servico',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'categoriaServico',
'field' => 'slug',
'terms' => $conteudoTaxonomia->slug
)
)
)
);
while ( $servicos->have_posts() ) : $servicos->the_post();
?>
<li><h3>|  <?php the_title(); ?></h3></li>
<?php endwhile; wp_reset_query(); ?>
</ul>
</div>
</div>
<?php
endforeach;
?>
Any suggestions?