-1

My doubt is how can I show a "term” of an specific taxonomy, the problem is that I have not found an applying example, just short code lines that don’t show me nothing at all.

I want please the entire code to show the post.

My post type names: “sección_deportes"
My taxonomy names: “tipo_deporte”
and the term I want to show: “futbol”

I just found this: https://stackoverflow.com/questions/13512137/how-to-sort-post-by-custom-taxonomy-in-wordpress?s=f36f5472-cf86-4e93-8ee2-5856d4ef06bf

but the loop shows me the same posts repeatedly.

  • It is not clear what you are trying to do. – s_ha_dum Mar 9 '14 at 0:51
  • I want to display a custom post belonging to a category of a taxonomy – Sema Hernández Mar 9 '14 at 0:56
0

I found the solution thanks to answer this question: Specify number of posts in my 'tax_query'

I wanted to show the posts for 'futbol' within the 'tipo_deporte' taxonomy:

        <?php
    $args = array(
        'posts_per_page' => 2,
        'tax_query' => array(
            array(
                'taxonomy' => 'tipo_deporte',
                'field' => 'slug',
                'terms' => array('futbol'),
                     )
            )
        );
    $query = new WP_Query( $args );

   if ( $query->have_posts() ) {
        while( $query->have_posts() ) {
            $query->the_post();

     //The Post

        }
    }
    ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.