Php Wordpress mysql查询特色图片

Php Wordpress mysql查询特色图片,php,mysql,wordpress,Php,Mysql,Wordpress,所以我有下面的查询,这是有效的,但我也需要的职位特色图片,你们可以帮我查询了 选择SQL\u CALC\u FOUND\u ROWS wp\u posts* 来自wp_帖子、wp_术语关系、wp_术语 其中wp_posts.ID=wp_term_relationships.object_ID和wp_posts.post_status='publish' 和wp_terms.term_id=wp_term_relationships.term_taxonomy_id GROUP BY wp_pos

所以我有下面的查询,这是有效的,但我也需要的职位特色图片,你们可以帮我查询了

选择SQL\u CALC\u FOUND\u ROWS wp\u posts* 来自wp_帖子、wp_术语关系、wp_术语 其中wp_posts.ID=wp_term_relationships.object_ID和wp_posts.post_status='publish' 和wp_terms.term_id=wp_term_relationships.term_taxonomy_id GROUP BY wp_posts.id ORDER BY wp_posts.post_日期描述限制0100


我最近不得不检索最近4篇带有特色图片的帖子,发现这真的很难。这段代码对我很有用(最终),我知道它可能不准确,但不可能在评论中发布,我相信它会有帮助:

SELECT title, name, date, content, CONCAT(LEFT(image, LENGTH(image) - LOCATE('.', REVERSE(image))),'-768x576.',SUBSTRING_INDEX(image, '.', -1)) AS image
            FROM (
             SELECT    
             p.post_title AS title, 
             p.post_status AS 'status', 
             p.post_date AS date,
             p.post_content AS content,
             p.post_name AS name,
             (SELECT `guid` FROM wp_posts WHERE id = m.meta_value) AS image
             FROM wp_posts p, wp_postmeta m
             WHERE p.post_type = 'post'
             AND p.post_status = 'publish'
             AND p.id = m.post_id
             AND m.meta_key = '_thumbnail_id'
             LIMIT 4
            ) TT

@Uffo-这证明对你有用吗?