I want to look up a page id and determine if it's a page or post. Then query that id and display stuff like title, featured image, etc.
This works for Pages:
query_posts('page=' . $featured_tab);
This works or Posts:
query_posts('p=' . $featured_tab);
This will tell me if $featured_tag is a post or page:
get_post_type( $featured_tab )
But this does not work
foreach ( $featarr as $featured_tab ) {
if (get_post_type( $featured_tab ) == 'page') {
$featured_tab_type = 'page=';
} elseif (get_post_type( $featured_tab ) == 'post') {
$featured_tab_type = 'p=';
}
query_posts($featured_tab_type . $featured_tab);
while (have_posts()) : the_post();
Echo 'stuff here';
The problem I am having is this...the $featured_tag variable represents an assigned page/post id that is displayed on a page.
So I feed in a string of id's, i.e., 34,543,2432,355... etc then take each id as $featured_tab and query for title, featured page and excerpt.
Then I display all the page/post id's in a three column table.
This work perfect but only if I query for one or the other but not both as I do in the if statement if post use p= or if page use page=.
When I use the if condition is get crazy results here if there are 9 ids, I get 50+ results...duplicates and only post no page are displayed.

query_postsworks just fine if I only want the retrieve Pagesquery_post(page=34)for just pages or query_posts(p=3435` for just posts but I need to query both. – Jason Dec 3 '12 at 6:35query_posts('p='. $featured_tab);query_posts('page='. $featured_tab);work just fine. So I tried to add a condition that checks if the id is a post or pageget_post_type()which outputs 'post' or 'page' and based on that use either 'p=' or 'page='...query_posts($featured_tab_type . $featured_tab)– Jason Dec 3 '12 at 6:40