View Single Post
  #1  
Old 10-22-2012, 01:36 PM
motty07 motty07 is offline
Registered User
Genesis Member
Pro Plus Member
 
Join Date: Feb 2012
Posts: 54
Default Display info from a specific custom post

Hi

I'm trying to display details from a specific custom post (using a post id) in the sidebar.

The code I'm using (just a starter test) is:

PHP Code:
function sidebar_photo_advert_static()
{
    
$spas_loop = new WP_query('p=7022');
    while ( 
$spas_loop->have_posts() ) : $spas_loop->the_post();
    echo 
'<li>';
    
the_title();
    echo 
'</li>';
endwhile;

It works fine if 7022 is a regular 'post', but not if is a custom post (say type = adverts). Any ideas on the query I need to use for a specific custom post type where the type is 'adverts' and the id 7022.?