Detect if post or page
-
How to detect in db query whether I got a post or page?
$result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5");
Here I get popular posts, but I get “About” page also.
foreach ($result as $post) { setup_postdata($post); // do some stuff }
So, I would like to check whether $post is page, if it is , then just jump it, or somehow to change query – to ignore pages, e.g. “AND NOT page” ??
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Detect if post or page’ is closed to new replies.