Customized page for each term

0

I have a taxonomy called Staff and a term called Professores , I created the taxonomy-staff.php page to display all the teachers contained in the staff and taxonomy-staff-professor.php taxonomy to display the teachers registered with the term teacher , but it is not displaying the page, it even obeys the route and changes the page title, but the content does not appear. Can anyone help me?

follow the link from taxonomy-stafftax-professor.php

link

<?php
  get_header();
  get_template_part( 'wp-files/partials/banner' );
?>

<div class="content">
  <h3>Perfis dos professores</h3>
  <?php
    $args = array(
      'posts_per_page' => -1,
      'post_type' => 'staff',
      'post_status' => 'publish',
      'tax_query' => array(
        array(
          'taxonomy' => 'stafftax',
          'field' => 'slug',
          'terms' => 'professor',
          )
        )
    );

    $loop = new WP_Query( $args );
    if ( $loop->have_posts() ) :  while ( $loop->have_posts() ) : $loop->the_post();

    $terms = get_the_terms( $post->ID, 'stafftax');
  ?>

  <ul>
    <li>
      <a href="<?php echo get_permalink(); ?>">
        <?php echo get_the_title(); ?>
      </a>
    </li>
  </ul>

<?php
  endwhile;
  endif;
  wp_reset_query();
?>


<?php get_footer() ?>
    
asked by anonymous 15.02.2017 / 22:49

1 answer

0

You are rewriting the query, so you may be having problems.

Try this: File taxonomy-stafftax-professor.php

<?php
  get_header();
  get_template_part( 'wp-files/partials/banner' );
?>

<div class="content">
  <h3>Perfis dos professores</h3>
  <ul>
  <?php if ( have_posts() ) :  while ( have_posts() ) : the_post(); ?>
    <li>
      <a href="<?php echo get_permalink(); ?>">
        <?php echo get_the_title(); ?>
      </a>
    </li>
<?php
  endwhile;
  endif;
  wp_reset_query();
?>
  </ul>    

<?php get_footer() ?>
    
16.02.2017 / 02:21