Advertisement
qlstudio

4 Trees - Tag Based Management Example

Nov 18th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. // home / about - arguments ##
  2. $args = array (
  3.     'post_type' => array( 'post', 'page' ), // select from a range or post types
  4.     'tax_query' => array(
  5.         'relation' => 'OR',
  6.         array(
  7.             'taxonomy' => 'post_tag',
  8.             'field' => 'slug',
  9.             'terms' => 'about' // this determines the slug of the term to use !! ##
  10.         ),
  11.         // add a second taxonomy to the selection ##
  12.         array(
  13.             'taxonomy' => 'page_tag',
  14.             'field' => 'slug',
  15.             'terms' => 'about'
  16.         )
  17.     ),
  18.     'orderby' => 'modified', // order by latest modified ##
  19.     'order' => 'DESC',
  20.     'posts_per_page' => 1, // only get one result - the latest edited ##
  21. );
  22.  
  23. // pass arguments to wp_query and return an object to the variable $about ##
  24. $about = new WP_Query( $args );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement