Retrieve posts custom fields in a loop

Support General Retrieve posts custom fields in a loop

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5945
    sergeysemenovsergeysemenov
    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.

    #5948
    Anh TranAnh 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
    sergeysemenovsergeysemenov
    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 TranAnh 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 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Retrieve posts custom fields in a loop’ is closed to new replies.