Select WordPress posts query with categories wise use core php

WordPress 0 Comments

If we are used the wordpress blog and than display the wordpress title name and other content in php page so  fetch the data from MYSQL database used the core php

write and discuss about the select the post title in mysql used the core php

Category Wise Select Title Name

Slug name Show in the query  ( AND t.slug = ‘result’ )  in Category  option (Show in  bottom of Category Name )  in wp-admin

$sqls=”SELECT *
FROM wp_posts p
LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID
LEFT OUTER JOIN wp_term_taxonomy x ON x.term_taxonomy_id = r.term_taxonomy_id
LEFT OUTER JOIN wp_terms t ON t.term_id = x.term_id
WHERE p.post_status = ‘publish’
AND p.post_type = ‘post’
AND t.slug = ‘result’
ORDER BY ID DESC LIMIT 14″;

 

 

$sqls= “SELECT DISTINCT wp_posts.* FROM wp_posts
LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)
WHERE wp_posts.post_status = ‘publish’
AND wp_term_taxonomy.taxonomy = ‘category’
AND wp_term_taxonomy.term_id IN (1033)
ORDER BY post_date DESC
LIMIT 5″;

 

$sqls=”SELECT DISTINCT
post_title FROM wp_posts p
LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID
LEFT OUTER JOIN wp_term_taxonomy x ON x.term_taxonomy_id = r.term_taxonomy_id
LEFT OUTER JOIN wp_terms t ON t.term_id = x.term_id
WHERE p.post_status = ‘publish’
AND wp_term_taxonomy.taxonomy = ‘category’
AND p.post_type = ‘post’ ORDER BY ID DESC LIMIT 16″;

 

$sqls=”SELECT DISTINCT
post_title FROM wp_posts p
LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID
LEFT OUTER JOIN wp_term_taxonomy x ON x.term_taxonomy_id = r.term_taxonomy_id
LEFT OUTER JOIN wp_terms t ON t.term_id = x.term_id
WHERE p.post_status = ‘publish’
AND p.post_type = ‘post’ ORDER BY ID DESC LIMIT 7”;

 

 


Bank PO clerk, SSC, Railway (RRB), IBPS, UPSC, IAS, RAS, SBI, 1st 2nd 3rd grade teacher,REET, TET, Rajasthan police SI, Delhi police, के महत्वपूर्ण सवाल जवाब के लिए रजिस्टर करे
आप करेंट अफेयर्स, Job, सामन्य ज्ञान ओर सभी exams संबंधित Study Material की जानकारी हैतु इस पेज को Like and Visit करे
https://www.facebook.com/myshort.Trick
and WWW.myshort.in

share..Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0