Support » Plugin: Flexi Pages Widget » [Plugin: Flexi Pages Widget] Flexi pages and query_posts

  • Resolved effex100


    This took me a little while to figure out so I figured I would share. I had a page template that used query_posts() to show a list of posts. I did this because I wanted Flexi Pages to show up and using a category on the menu didn’t achieve this.

    Problem is query_posts masses with the page info FlexiPages uses and it wasn’t showing up. After a bit I figured out this solution.

    before your query_posts() add this code
    <?php $temp_post = clone $post; ?>

    Then after your done but before the FlexiPages widget, switch it back.
    <?php $post = clone $temp_post; ?>

    This seems to preserve the page information the widget needs to function. This is effectively the same as the process for having multiple loops outlined here but for whatever reason swapping out wp_query didn’t work. If any WP gurus want to chime in with why that is that would be cool. Otherwise I’m just hoping this info will help someone out.

  • The topic ‘[Plugin: Flexi Pages Widget] Flexi pages and query_posts’ is closed to new replies.