StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
  #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.?
  #2  
Old 10-23-2012, 08:07 AM
NicktheGeek's Avatar
NicktheGeek NicktheGeek is offline
Forum Manager
 
Join Date: Feb 2010
Posts: 62,650
Default

you need to se the post type.
PHP Code:
$spas_loop = new WP_query('post_type=adverts&p=7022'); 
__________________
Nick "Fred and/or George Weasley" Croft
Designs by Nick the Geek
@Nick_theGeek on Twitter

Make web design easier, get FireBug for FireFox

Want to learn more about Genesis? Check out my Genesis Explained Series

 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom post info for a specific category pxforti General Discussion 4 05-29-2012 06:19 PM


All times are GMT -5. The time now is 12:33 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.