WordPress.org

Ready to get started?Download WordPress

Forums

Get the content by post id (3 posts)

  1. crisispictures
    Member
    Posted 9 years ago #

    Okay, I know this has been answered elsewhere, so a link is as good as an answer. (searched, but I did not find.)

    I need to get a single post by ID, which is a variable.

    Can I use:
    query_posts("p=$newpostid");

    It's a bit fiddly..I'm using this in a popup called slideshow.php.

    everything works but the part above, but fyi, what I'm trying to do is post the postid to slideshow.php (not index.php)-- run the loop, putting the get_the_content into a variable.

    then i run a bunch of regex thingies to pull out imagenames and captions, then makes a beautiful slideshow.

  2. trevorturk
    Member
    Posted 9 years ago #

    I had some problems with the query_posts() function. You could try to write it like this:

    query_posts('p='.$newpostid.'');

    I did that on my issue and it worked. I can't test your thing now, though, but I think that would work.

    http://codex.wordpress.org/Template_Tags/query_posts#Retrieve_a_Particular_Page

  3. crisispictures
    Member
    Posted 9 years ago #

    Yep.

    It worked.

    btw.

    to post on a file other than index.php
    put this in whatever.php

    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');

Topic Closed

This topic has been closed to new replies.

About this Topic