Query Events
-
I would like to pull the events in with a custom query.
Here is my code but I am not successful getting this to work properly:<?php global $post; $querywe_args = array( 'posts_per_page' => 2, // change this to any number or '0' for all 'post_type' => 'event', 'tax_query' => array( array( 'taxonomy' => 'post_tag', 'field' => 'slug', 'terms' => $post->post_name // this gets the page slug ) ) ); // a new instance of the WP_query class $querywe = new WP_Query( $querywe_args ); ?>
It is querying posts that are a post type of event that has a tag that matches the current page’s page slug. This works fine for my regular posts.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Query Events’ is closed to new replies.