Custom Fields
Re-Envisioned
Support General Retrieve posts custom fields in a loop

  • Creator
    Topic
  • #5945
    sergeysemenov
    Participant

    Hello. I need to make category archive with my posts and to open posts in popup as quick preview. What’s the code to put inside popup? For now, clicking all posts my popup shows custom fields only from the first post.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #5948
    Anh Tran
    Keymaster

    You need to pass the $post_id as the last parameter in the rwmb_meta function. Please read this docs for details.

    #5950
    sergeysemenov
    Participant

    Thanks for assistance, Anh Tran. But what if I need to retrieve metaboxes in a loop? Not from exact post but from the postroll? I’ve got a category displaying 19 posts in total. Some sort of a store. I want to click on every postblock in a roll and get quick view popup. What parameter do I have to put as $post_id?

    #5956
    Anh Tran
    Keymaster

    If you’re in a loop and called the function $query->the_post(), then you don’t need to pass any variable. The current post ID (retrieved via get_the_ID()) is passed by default.

    If that doesn’t work, please post the code you use in the loop.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Retrieve posts custom fields in a loop’ is closed to new replies.

Newsletter

Subscribe to our newsletter to receive news and tutorials for Meta Box and WordPress.


grid gear info copy caret-up caret-down trash