Home Forums Product Support Aesop Story Front Using wp_reset_postdata() with Aesop Story Front

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2504
    Chris
    Participant

    Hi,

    I’m trying to create a lists of links in a fixed header to all of the posts on my website (which uses Aesop Story Engine/Story Front).

    I’m doing this with a simple WP_Query. Grabbing the permalinks to all of my posts, outputting them via a new loop, then calling “wp_reset_postdata()” to reset the WordPress loop. It works perfectly everywhere except on the homepage, which is using Aesop Story Front.

    The problem I’m having is that wp_reset_postdata() resets the loop back to the static front page (defined in the WP settings) rather than back to the story post which I’ve set using this plugin (so instead of showing the story post assigned to the front page, it shows the actual content of that static page).

    If there’s any guidance you can give me to help me solve this that would be great.

    Thanks a lot.

    #2505
    Chris
    Participant

    Hi again,

    I managed to solve my problem by re-writing my code a bit.

    I replaced my WP_Query call with a “get_posts()” call. Then manually looping the returned array of posts with a “foreach” and outputting what I needed (ie. so I’m not altering the main WP loop or global $post variable at all)

    So the way I got around it was just to avoid using wp_reset_postdata() altogether. More of a work-around than a fix, but it works for what I need!

    Thanks!

    #2511
    Jenny @ Aesop
    Keymaster

    Hi Chris! Thanks for letting us know you solved the issue on your own.

    In your case, get_posts is probably the best route. The Story Front plugin redirects the template entirely.

    If you need any further help, just let us know!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.