I've created a "portafolio" custom type in Wordpress and I would like to query a specific post (ID = 780 to be exact) in this code I've written, which retrieves all attachments images inside that post:

Hi martinCzerwi, thanks for your answer. I have tried the following code just to test if I was able to retrieve the query without success. I've edited the question for you to see the code.
–
JohannAug 29 '12 at 14:46

Just to be sure, according to your edit-code, you see <h2>Test</h2> 0 times, meaning it doesn't loop? I've copied exactly your edit-code but changed the ID, and it works just fine (shows Test 1 time). You can even create a template-file like home.php with only including your code, to make it work.
–
martinczerwiAug 29 '12 at 14:56

That is correct martinCzerwi. I have created a home.php file with the provided code and it's not looping. I don't see the "test" heading. Don't know if this might help to clarify, but the post I am trying to retrieve is from a custom type.
–
JohannAug 29 '12 at 15:06

Good hint, I added a custom post type, it didn't work until I had this: query_posts( array('p' => 780, 'post_type' => 'portafolio') );
–
martinczerwiAug 29 '12 at 15:19

Hi martinCzerwi, thanks a lot! That was definitely what was missing :)
–
JohannAug 29 '12 at 16:15

Hi Soju, thanks for your answer. Where in my code should I put these variables? I'm not sure which ones to replace.
–
JohannAug 29 '12 at 14:38

It depends, why do you want to query this post ? Where do you want to display it ?
–
sojuAug 29 '12 at 14:39

It's a page I am creating to display a single post and then display it in the homepage. From what I understand, Wordpress won't allow single posts to be selected as front pages.
–
JohannAug 29 '12 at 14:50