bestcssdesigns
Member
Posted 4 months ago #
Hey,
I went to http://codex.wordpress.org/Template_Tags/query_posts and I tried using this code in my template.
<?php
// retrieve one post with an ID of 5
query_posts('p=5');
?>
This code did not work. I changed the ID to the ID of the post I wanted to show, and it never showed on the front page. Then when I used the following code, I got a parse error.
<?php
// retrieve one post with an ID of 5
query_posts('p=5');
global $more;
// set $more to 0 in order to only get the first part of the post
$more = 0;
// the Loop
while (have_posts()) : the_post();
// the content of the post
the_content('Read the full post ยป');
endwhile;
?>
Hi,
Use this code to retrieve the post from the post ID:
query_posts('showposts=5');
This will retrieve post where post ID = 5
Thanks,
Shane G.
bestcssdesigns
Member
Posted 4 months ago #
Hey Shane, I tried that.
<?php
// retrieve one post with an ID of 5
query_posts('showposts=5');
?>
It still did not work...
<?php query_posts('p=5'); ?> seems to be working fine for me.
bestcssdesigns
Member
Posted 4 months ago #
<?php query_posts('p=5'); ?>
Is suppose to show the content from that post on the page right?
No, it loads the post with an ID of 5 into the query. The Loop following the query can show the post content.
bestcssdesigns
Member
Posted 4 months ago #
So if I want to show the post with ID 5, what code would I have to use?
bestcssdesigns
Member
Posted 4 months ago #
Also, will I have to insert a loop code on the page. Like what is everything I'd need to put on the page to show the title and content from a specified post?
Like I've been looking everywhere and trying various codes. Some codes give me errors. Some simply don't show anything...