Skip to content

Instantly share code, notes, and snippets.

@benfavre
Created September 12, 2018 15:50
Show Gist options
  • Save benfavre/0a1fc86cae62daf66fc686205b0054af to your computer and use it in GitHub Desktop.
Save benfavre/0a1fc86cae62daf66fc686205b0054af to your computer and use it in GitHub Desktop.
test
<div class="col-md-12">
<?php
// WP_Query arguments
$args = array(
'post_type' => array('adresses'),
'orderby' => 'menu_order',
'order' => 'ASC',
'child_of' => 1,
'posts_per_page' => 10
'tax_query' => array( // (array) - use taxonomy parameters (available with Version 3.1).
array(
'taxonomy' => 'category-adresses', // (string) - Taxonomy.
'field' => 'slug', // (string) - Select taxonomy term by Possible values are 'term_id', 'name', 'slug' or 'term_taxonomy_id'. Default value is 'term_id'.
'terms' => array('10'), // (int/string/array) - Taxonomy term(s).
'include_children' => true, // (bool) - Whether or not to include children for hierarchical taxonomies. Defaults to true.
'operator' => 'IN' // (string) - Operator to test. Possible values are 'IN', 'NOT IN', 'AND', 'EXISTS' and 'NOT EXISTS'. Default value is 'IN'.
),
),
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post(); ?>
<h3><a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a></h3>
<p><?php echo get_post_meta(get_the_ID(), 'description', true); ?></p>
<?php }
}
// Restore original post data.
wp_reset_postdata();
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment