black friday sale

Custom Fields
Re-Envisioned
Support Meta Box Builder frontpage & output picture, php error

  • Creator
    Topic
  • #22605
    jw_bln
    Participant

    I am using EXACT the method described in your own documentation to show a single image:

    <?php
        $images = rwmb_meta( 'xximagefieldxx', array( 'limit' => 1 ) );
        $image = reset( $images );?>
    <img src="<?php echo $image['url'];?>" width="xx" height="xx>

    but getting a PHP error:
    WARNING: reset() expects parameter 1 to be array, string given in var/www/xxx/ eval()'dcode on line 3

    So what’s wrong? Documentation?

    It’s worth mentioning that currently only one picture is stored in the field…
    Seems reset( $images ) refers to the same Image ID (the only existing one), maybe this is the error.
    The picture itself is printed out to html.

    Any advice?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #22608
    Long Nguyen
    Moderator

    Hi,

    The code sample code is working well on my local site. Please ensure that the field ID is correct and the code is added to the post’s template.

    You can also share the code that creates the field image. I will take a closer look.

    #22673
    jw_bln
    Participant

    Sorry for the late reply.
    I need to mention again, that
    a) The picture itself is shown on the frontend, only in oxygen page builder (backend) it shows this behavior
    b) I am using the graphical builder, so all is automatically added
    c) There is only one picture existing, but reset() is an array function??
    d) Fields are existing, otherwise the picture would not have been visible

    I will check with the Oxypagebuilder support too.

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