• I am trying to use WordPress as a content management system to dynamically update the media on my website. Mostly going to be videos from vimeo, but also some photos and I want to be able to link to the full articles on the wordpress site too.

    I have a content div which will contain whatever the important piece of content is, generally a video which has been linked from vimeo.

    I have a navigator div which will dynamically update with 5 most recent thumbnails from the posts featured images. Clicking on any one of these will change the content div accordingly.

    http://www.3dmediawatch.com/ Static version to figure out the layout.

    I have basically the whole concept worked out in my head, and quasi-code in a notebook, ready to start the real work of it, and suddenly I can’t even get started. For some reason, when I do this:

    <?php
    define(‘WP_USE_THEMES’, false);
    require(‘../wordpress/wp-load.php’);
    query_posts(‘posts_per_page=5’);
    ?>

    <?php while (have_posts()): the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <p>Date posted: <?php the_date(); ?></p>
    <?php endwhile; ?>

    instead of bringing up the last 5 posts, it is bringing up some random phantom of a post which I can’t understand where it came from. It is a single photo, full size, with a caption above it, which was I believe the 2nd photo ever uploaded to wordpress.

    http://www.3dmediawatch.com/dynamic_test.php

    I read somewhere that I can potentially corrupt my WP_Query object by using query_posts in the wrong place. Is that what happened? Should I use get_posts instead?

    I have been struggling with this for over 4 hours now and don’t know where to begin looking for a solution. I’ve searched for every semi-applicable phrase I can think of. Can anyone give me any suggestions?

The topic ‘query_posts returning phantom page.’ is closed to new replies.