Custom Fields
Re-Envisioned
Support Meta Box Group Displaying image from a group field

  • Creator
    Topic
  • #31521
    Resolved chaomancer@gmail.com
    Participant

    Hi,

    I'm new to this kind of thing, and having some problems. Hope I'm posting in the right place.

    I'm trying to put together a way to display book data by series for an author website. So I have created the SERIES post type which has custom fields for information about the series, and then a cloneable group book_data to add the data for each book in that series. I'm using an Oxygen repeater (using the Oxygen 3.9 beta for Meta Box integration).

    However, I can't work out how to get the cover image to display as anything other than a thumbnail. This wasn't an issue for the series cover image, which is not in the cloneable group.

    I've tried using a code block instead, and that way I can get non-thumbnail images, but they all appear in each instance of the repeater, so each book shows as having every cover in the series. Here's the code I used:

    <?php
    $my_group = rwmb_meta( 'book_data' );
    foreach ( $my_group as $group_value ) {
        $images = isset( $group_value['book_image_advanced_u1tymdel9bn'] ) ? $group_value['book_image_advanced_u1tymdel9bn'] : array();
        foreach ( $images as $image ) {
            $image = RWMB_Image_Field::file_info( $image, array( 'size' => 'medium' ) );
            // print_r( $image );
            echo "<img src='{$image['url']}' />";
        }
        ?>
            <?php
    }
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #31534
    Long Nguyen
    Moderator

    Hi,

    The code displays images from a cloneable group field on the single post as well. So you need to contact Oxygen support to ask for adding the code to the repeater module on each post.

    #31543

    Okay, thank you 🙂 I'll check with them.

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