WordPress.org

Ready to get started?Download WordPress

Forums

Using get_post_custom_values out of the loop? (4 posts)

  1. blakekr
    Member
    Posted 8 years ago #

    get_post_custom_values works brilliantly in my single.php, but I can't get a value out of it when I try to use it in my sidebar. I'm guessing it's designed to work within The Loop?

    Is there a way I can retain this value and use it again in my sidebar, or use get_post_custom_values outside of the loop?

  2. Austin Matzko
    Member
    Posted 8 years ago #

    The problem with being outside of the loop is that get_post_custom_values() doesn't know which post you want values from. Try creating a new loop in your sidebar. See the codex here for instructions on creating such a loop.

  3. blakekr
    Member
    Posted 8 years ago #

    THANKS!!

  4. blakekr
    Member
    Posted 8 years ago #

    Okay, I'm still having a little trouble with this because it stops my "breadcrumb" plugin from working ... my sidebar loads before my main content, and the breadcrumb plugin is supposed to be "out of the loop." I think the page you showed me offers some workarounds, but I haven't mastered them yet. I'll post back later as I try some more ....

Topic Closed

This topic has been closed to new replies.

About this Topic