Select WordPress posts query with categories wise use core php

Computer 0 Comments
wordpress-code

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

Daily Visit GK on myshort.in

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”;

 

 

Buy online Rajasthan gk book Railway JE CBT REET PAtwari Book SSC CGL Clerk GD Book Buy online Rajasthan gk book Railway JE CBT REET PAtwari Book SSC CGL Clerk GD Book

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