WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] query_posts in 2.1? (3 posts)

  1. andrewkhunn
    Member
    Posted 7 years ago #

    Was there a change made to the query_posts function such that it is know breaking after upgrading from 2.05 to 2.1? The following code is meant to do a lookup for a page which has a specific parent (the "Sidebars" category) and name which matches the name of the page we're currently on.

    <?php
    $sidebar_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '30' AND post_name = '$post->post_name'");
    query_posts('page_id='.$sidebar_id.'');
    if ( $sidebar_id != '' ) :
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    ?>
    <div id="post_meta" class="prominent reduced"><div class="inner">
    <?php the_content(); ?>
    </div></div>
    <?php endwhile; endif; else: ?>
    <div id="post_meta" class="prominent reduced"><div class="inner">
    <h3>Upcoming Events</h3>
    <p><?php showImage(); ?></p>
    </div></div>
    <?php endif; ?>

    This was successfully working previously. What changed?

  2. JaneLitte
    Member
    Posted 7 years ago #

    Do you have the Adhesive plugin? That might be causing problems.

  3. andrewkhunn
    Member
    Posted 7 years ago #

    Holy crap. I was pulling my hair out.

    Adhesive was indeed causing the issues. I thought it was 2.1-compatible. Guess I'll wait for an update.

    Thanks so much!

Topic Closed

This topic has been closed to new replies.

About this Topic