Created
January 4, 2017 11:54
-
-
Save serkanalgur/12adb312c52e3f12db5eb88c0ee0a27d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $args = array( | |
| //Sayfa ve Yazı parametreleri | |
| 'p' => 1, | |
| 'name' => 'hello-world', | |
| 'page_id' => 1, | |
| 'pagename' => 'sample-page', | |
| 'post_parent' => 1, | |
| 'post__in' => array(1,2,3), | |
| 'post__not_in' => array(1,2,3), | |
| //Yazar Parametreleri | |
| 'author' => '1,2,3,', | |
| 'author_name' => 'admin', | |
| //Kategori Parametreleri | |
| 'cat' => 1, | |
| 'category_name' => 'blog', | |
| 'category__and' => array( 1, 2), | |
| 'category__in' => array(1, 2), | |
| 'category__not_in' => array( 1, 2 ), | |
| //Tür ve Durum Parametreleri | |
| 'post_type' => '', | |
| 'post_status' => '', | |
| //Tür ve Durumların listesi aşağıdadır. Lütfen Buradan birini kullanın | |
| 'post_type' => array( | |
| 'post', | |
| 'page', | |
| 'revision', | |
| 'attachment', | |
| 'my-post-type', | |
| ), | |
| 'post_status' => array( | |
| 'publish', | |
| 'pending', | |
| 'draft', | |
| 'auto-draft', | |
| 'future', | |
| 'private', | |
| 'inherit', | |
| 'trash' | |
| ), | |
| //Sıralama ve sıralama türü Parametreleri | |
| 'order' => 'DESC', | |
| 'orderby' => 'date', | |
| 'ignore_sticky_posts' => false, | |
| 'year' => 2012, | |
| 'monthnum' => 1, | |
| 'w' => 1, | |
| 'day' => 1, | |
| 'hour' => 12, | |
| 'minute' => 5, | |
| 'second' => 30, | |
| //Etiket Parametreleri | |
| 'tag' => 'cooking', | |
| 'tag_id' => 5, | |
| 'tag__and' => array( 1, 2), | |
| 'tag__in' => array( 1, 2), | |
| 'tag__not_in' => array( 1, 2), | |
| 'tag_slug__and' => array( 'red', 'blue'), | |
| 'tag_slug__in' => array( 'red', 'blue'), | |
| //Sayfalama Parametreleri | |
| 'posts_per_page' => 10, | |
| 'posts_per_archive_page' => 10, | |
| 'nopaging' => false, | |
| 'paged' => get_query_var('paged'), | |
| 'offset' => 3, | |
| //Özel alan Parametreleri | |
| 'meta_key' => 'key', | |
| 'meta_value' => 'value', | |
| 'meta_value_num' => 10, | |
| 'meta_compare' => '=', | |
| 'meta_query' => array( | |
| array( | |
| 'key' => 'color', | |
| 'value' => 'blue', | |
| 'type' => 'CHAR', | |
| 'compare' => '=' | |
| ), | |
| array( | |
| 'key' => 'price', | |
| 'value' => array( 1,200 ), | |
| 'compare' => 'NOT LIKE' | |
| ), | |
| //Taksonomi Parametreleri | |
| 'tax_query' => array( | |
| 'relation' => 'AND', | |
| array( | |
| 'taxonomy' => 'color', | |
| 'field' => 'slug', | |
| 'terms' => array( 'red', 'blue' ), | |
| 'include_children' => true, | |
| 'operator' => 'IN' | |
| ), | |
| array( | |
| 'taxonomy' => 'actor', | |
| 'field' => 'id', | |
| 'terms' => array( 1, 2, 3 ), | |
| 'include_children' => false, | |
| 'operator' => 'NOT IN' | |
| ) | |
| ), | |
| //İzin Parametreleri | |
| 'perm' => 'readable', | |
| //Cache ile ilgili Parametreler | |
| 'no_found_rows' => false, | |
| 'cache_results' => true, | |
| 'update_post_term_cache' => true, | |
| 'update_post_meta_cache' => true, | |
| ); | |
| $query = new WP_Query( $args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment