Flexi Pages Widget
[resolved] Flexi pages and query_posts (1 post)

  1. effex100
    Posted 5 years ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Flexi Pages Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.