WordPress.org

Support

Support » Plugins and Hacks » Using get_post_custom_values out of the loop?

Using get_post_custom_values out of the loop?

  • 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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    THANKS!!

    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 ….

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using get_post_custom_values out of the loop?’ is closed to new replies.