Say "Hello!"

  • This field is for validation purposes and should be left unchanged.

query_posts for Custom Post Types


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
        query_posts( array('post_type' => 'Snippets',
        'posts_per_page' => -1,
        'tax_query' => array(
            array(
                'taxonomy' => 'language',
                'field' => 'slug',
                'terms' => 'sql'
                )
            )
        )
    );
while ( have_posts() ) : the_post();
echo "<a href='". the_permalink() ."'>". the_title()."</a>";
the_terms( $post->ID, 'language', 'Tagged in: ', ', ', ' ' );
endwhile;

Back to Snippets Follow me on GitHub

Ashley Cameron logo
Blog