SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) LEFT JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) LEFT JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id ) LEFT JOIN wp_postmeta AS mt2 ON ( wp_posts.ID = mt2.post_id AND mt2.meta_key = 'dl_material' )
WHERE 1=1 AND (
wp_term_relationships.term_taxonomy_id IN (159)
AND
tt1.term_taxonomy_id IN (7)
) AND (
wp_postmeta.meta_key = 'dl_material'
AND
(
(
( mt1.meta_key = 'dl_material' AND mt1.meta_value = '1' )
OR
( mt1.meta_key = 'dl_material' AND mt1.meta_value = '2' )
OR
( mt1.meta_key = 'dl_material' AND mt1.meta_value = '3' )
OR
( mt1.meta_key = 'dl_material' AND mt1.meta_value = '4' )
OR
( mt1.meta_key = 'dl_material' AND mt1.meta_value = '5' )
OR
mt2.post_id IS NULL
)
)
) AND ((wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'publish')) OR (wp_posts.post_type = 'catalog' AND (wp_posts.post_status = 'publish')) OR (wp_posts.post_type = 'history' AND (wp_posts.post_status = 'publish')) OR (wp_posts.post_type = 'page' AND (wp_posts.post_status = 'publish')) OR (wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')))
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC
LIMIT 0, 12
ПОКАЗЫВАТЬ НА СТРАНИЦЕ: 12 24 36