Help with displaying images from a URL in a cloneable Meta Box group

Support MB Group Help with displaying images from a URL in a cloneable Meta Box group

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38114
    Owais SidatOwais Sidat
    Participant

    Hi all,

    My first post here. I've been trying to solve an issue I'm having for around a week now and I just can't seem to figure it out. I have a custom post type of "vehicles" which has the slug "used-cars". Inside this custom post type I have a cloneable Meta Box group "Images" which has an id of "media_images". Nested inside this group I have a URL field which has the id "href". I can see that all of the URLs for the images are populating correctly via the API I am using, but I can't for the life of me get them to display on the front end. I need to have the images in a slider or carousel of some sort, and I've tried various options but I can't seem to get any of them to work. Please can someone help? I'm open to solutions using custom code if needed.

    Thanks!

    #38115
    Owais SidatOwais Sidat
    Participant

    I can dump all of the images onto the page using meta box views with the below code:

    <div class = 'vehicle-images'>
    	{% for clone in post.media_images %}
    		<div class='vehicle-image'>
    			<img src={{ clone.href }} alt="Test" width="500" height="600">
    		</div>
    	{% endfor %}
    </div>

    And I can also display them all using the PHP code below:

    <?php
      $images = rwmb_meta( 'media_images' ) ?: [];
      foreach ( $images as $image ) {
          echo '<div class="image">';
          echo '<img src="' . $image['href'] . '">';
          echo '</div>';
      }
    ?>

    But I just can not get them into a slider or carousel of any sort. I am using Bricks Builder as my page builder and Bricks Extras for the slider which I believe uses SplideJS.

    #38118
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The code looks correct to output the subfield value in a group. And you can also follow this article to know how to display it in a carousel/slider with WP Grid Builder or Elementor.
    https://metabox.io/show-featured-restaurants-on-homepage-p1-meta-box-elementor-wp-grid-builder/

    With the Bricks Builder, they have created the integration with Meta Box so you can contact their support to ask for displaying field values in a slider.

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