Home
Explore
Submit Search
Upload
Login
Signup
Advertisement
Check these out next
jQuery プラグインの作り方
Takeru Suzuki
Jquery2
Inbal Geffen
Analizador sintáctico de Pascal escrito en Bison
Egdares Futch H.
Making DSL with []
Yuya Takeyama
Templating WordPress
Konstantin Kovshenin
Comparison Principle
อิทธิเดช มูลมั่งมี
BABELで、ES2015(ES6)を学ぼう!
Toshio Ehara
With enter
Ani Mikaelyan
1
of
32
Top clipped slide
Секреты WP_Query
Jul. 6, 2012
•
0 likes
1 likes
×
Be the first to like this
Show More
•
5,233 views
views
×
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Download Now
Download to read offline
Report
Technology
Konstantin Kovshenin
Follow
Developer at Automattic
Advertisement
Advertisement
Advertisement
Recommended
Knowlage
Afaf A. Habib
12 views
•
1 slide
Iteratory
Łukasz Kużyński
1.4K views
•
33 slides
PHPのすべらない話#3
Moriyoshi Koizumi
1.1K views
•
27 slides
Адаптация TInyMCE редактора под нужды клиента by Vitaly Nikolaev
WordCamp Kyiv
248 views
•
24 slides
Add tag shortcode
Peter Baylies
297 views
•
1 slide
Simular un next del recordset en php de forma rudimentaria
jbersosa
665 views
•
8 slides
More Related Content
Slideshows for you
(20)
jQuery プラグインの作り方
Takeru Suzuki
•
3.8K views
Jquery2
Inbal Geffen
•
890 views
Analizador sintáctico de Pascal escrito en Bison
Egdares Futch H.
•
1.8K views
Making DSL with []
Yuya Takeyama
•
1.7K views
Templating WordPress
Konstantin Kovshenin
•
6.5K views
Comparison Principle
อิทธิเดช มูลมั่งมี
•
305 views
BABELで、ES2015(ES6)を学ぼう!
Toshio Ehara
•
2.1K views
With enter
Ani Mikaelyan
•
146 views
12 PREMIO “1ER LUGAR” 9NA COPA GRUNDY.PDF
Randy Mujica
•
130 views
PHP Profiling
Sungbum Hong
•
1.5K views
Miniray.php
maeeeng69
•
42 views
jQuery PLUGIN
blueweb_sk
•
270 views
Quiz Component For Joomla
guestebb21a
•
762 views
Sumahexavector
jbersosa
•
155 views
Jquery Plugin
Simone Gentili
•
619 views
certs.PDF
Masood Inayat RRPT
•
206 views
Feeds. использование и создание плагинов. Feeds API
Alex S
•
8K views
Minishell
hacker indonesia
•
624 views
Working With Ajax Frameworks
Jonathan Snook
•
6.7K views
Web Programming - Toko Bunga Red Flower
Doni Andriansyah
•
5K views
More from Konstantin Kovshenin
(14)
Memory Management in WordPress
Konstantin Kovshenin
•
1.5K views
Пожиратели памяти в WordPress
Konstantin Kovshenin
•
12.4K views
7 убийц производительности WordPress
Konstantin Kovshenin
•
2.7K views
WordPress под нагрузкой: масштабирование и отказоустойчивость
Konstantin Kovshenin
•
3.1K views
Будущее WordPress (SPB, 2014)
Konstantin Kovshenin
•
718 views
Road to Platform @ WordPress.com VIP Workshop 2014
Konstantin Kovshenin
•
809 views
Будущее WordPress
Konstantin Kovshenin
•
1K views
Как повысить скорость вашего сайта на WordPress
Konstantin Kovshenin
•
3.5K views
Things I Wish I Had Known Before Developing a WordPress Theme
Konstantin Kovshenin
•
3.6K views
Основые безопасности WordPress
Konstantin Kovshenin
•
2.5K views
Цикл разработки WordPress
Konstantin Kovshenin
•
2.2K views
7 Tips for Better WordPress Theme Development
Konstantin Kovshenin
•
12.8K views
The Settings API
Konstantin Kovshenin
•
11.3K views
P2
Konstantin Kovshenin
•
1.4K views
Advertisement
Recently uploaded
(20)
Convert to HTML CSS
Samaritan Technologies
•
1 view
留学美国必看:美国社区大学毕业证、学位证办理流程
oqcymp
•
3 views
加拿大蒙特埃里森大学毕业证文凭成绩单制作指南
nahej99297
•
3 views
无法毕业?美国蒙茅斯大学毕业证书和学位证书办理
sefomo
•
4 views
无法毕业?德国克劳斯塔尔工业大学毕业证书和学位证书办理
sefomo
•
2 views
검증바카라 [WWW.RTЗЗ.TOP]코드:b77 시에라리온 분석 ⑩ psg ㈾ 필리핀온라인카지노 ㊡ 토토사이트메이저 ⑾ 온라인카지노바카라 ...
sangin3
•
7 views
留学法国必看:波尔多一大毕业证、学位证办理流程
oqcymp
•
3 views
哪里可以买加拿大圣力嘉学院毕业证文凭
aswdgyo
•
4 views
最新1:1仿造科廷大学毕业证文凭
ueususw
•
2 views
在哪里可以办加拿大大学文凭《布兰登大学毕业证成绩单仿制》
bqexmu
•
3 views
테니스토토 {ωωω.rt33.top}코드:b77 아메리칸사모아 국가대표 Ⓖ mcm토토 ㊛ 88카지노 ㋴ 프리미어리그경기일정 ⒦ 몰타 분석 ...
sangin3
•
8 views
留学美国必看:纽约大学毕业证、学位证办理流程
yuazbb
•
3 views
最新1:1仿造纽约州立大学水牛城分校毕业证文凭
gboth
•
2 views
메이저카지노사이트 [ωωω.rt33.top]코드 B77 농구토토w매치74회차 ⌽ 필리핀블랙잭 ވ 로스토프 😡 세네갈 바카라 ⑧ 북한 경기 ...
1xBet 원엑스벳
•
22 views
스포츠중계 《www,rtЗЗ,top》코드 b77 야추주사위 চ 세계축구중계 🚇 몽골 바카라 ڊ 호텔카지노바카라 ㈺ 봄비토토 👓 야구실시간중계
1xBet 원엑스벳
•
37 views
学校原版仿《敦达克理工学院毕业证学士学位证书》
gbxyz
•
2 views
最新1:1仿造爱丁堡大学毕业证文凭
gboth
•
3 views
ホールデムサイト 【www,rt33,top】コードb77 バカラ予測 💨 コモロ ℭ mgmちょっとリアルタイム ๊ エンジエンバカラ ᄎ ビビカジノ ...
ssuser8be025
•
8 views
Elixir Deck.pdf
Jun-You Liu
•
3 views
学校原版仿《伯恩茅斯艺术学院毕业证学士学位证书》
gbxyz
•
2 views
Секреты WP_Query
WP_Query
is_home() is_single() is_page()
query_posts()
if ( have_posts()
) while ( have_posts() ) the_post();
query_posts( 'cat=-5' ); $posts
= get_posts( 'cat=-5' ); $posts = new WP_Query( 'cat=-5' );
10 posts
10 posts
+ 10 posts cat = -5
max_num_pages = 3
index.php 404.php max_num_pages = 5
pre_get_posts
add_action( 'pre_get_posts', 'my_func'
); function my_func( $query ) { $query->set( 'cat', '-5' ); }
$query->is_main_query()
add_action( 'pre_get_posts', 'my_func'
); function my_func( $query ) { if ( $query->is_main_query() ) $query->set( 'cat', '-5' ); }
add_action( 'pre_get_posts', 'my_func'
); function my_func( $query ) { if ( $query->is_main_query() ) if ( $query->is_search() ) $query->set( 'post_type', 'post' ); }
add_action( 'pre_get_posts', 'my_func'
); function my_func( $query ) { if ( $query->is_main_query() ) if ( $query->is_search() ) $query->set( 'posts_per_page', 30 ); }
add_action( 'pre_get_posts', 'my_func'
); function my_func( $query ) { if ( $query->is_main_query() ) if ( $query->is_home() ) $query->set( 'post_type', array( 'post', 'book', ) ); }
query_posts(); $posts = get_posts(); $posts
= new WP_Query();
$popular = new
WP_Query( 'cat=3' ); while ( $popular->have_posts() ) { $popular->the_post(); ... }
$popular = new
WP_Query( 'cat=3' ); while ( $popular->have_posts() ) { $popular->the_post(); ... } // Основной запрос while ( have_posts() ) { the_post(); ... }
// Основной запрос while
( have_posts() ) { the_post(); ... $category = get_the_category(); $related = new WP_Query( 'cat=' ... ); while ( $related->have_posts() ) { $related->the_post(); ... } }
query_posts()
$wp_query
function have_posts() {
global $wp_query; return $wp_query->have_posts(); }
$wp_query =& $wp_the_query;
function &query_posts( $query
) { ... unset( $wp_query ); $wp_query = new WP_Query(); return $wp_query->query( $query ); }
function wp_reset_query() {
... unset( $wp_query ); $wp_query =& $wp_the_query; }
$popular = new
WP_Query( 'cat=3' ); while ( $popular->have_posts() ) { $popular->the_post(); ... } // Основной запрос while ( have_posts() ) { the_post(); ... }
query_posts( 'cat=3' ); while
( have_posts() ) { the_post(); ... } wp_reset_query(); // Основной запрос while ( have_posts() ) { the_post(); ... }
Если нужно изменить
основной запрос pre_get_posts
Если нужен вторичный
запрос new WP_Query; get_posts()
Если нужна головная
боль query_posts()
Advertisement