Support » Plugin: Meta Box - WordPress Custom Fields Framework » Advanced Images doesnt seem

  • Resolved helvetica123

    (@helvetica123)


    Hi, I am new with this plugin.I cant print advanced picture in single post.

    my single.php code:

    <!-- Metabox pic -->
    <?php
    
    $images = rwmb_meta( 'untitled', 'type=image_advanced&size=full' );
    foreach ( $images as $image ) {
        echo "<img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' />";
    }
    
    ?>

    and function.php:

    	$prefix = 'prefix-';
    
    	$meta_boxes[] = array(
    		'id' => 'untitled',
    		'title' => esc_html__( 'Untitled Metabox', 'metabox-online-generator' ),
    		'post_types' => array('post', 'page' ),
    		'context' => 'advanced',
    		'priority' => 'default',
    		'autosave' => 'false',
    		'fields' => array(
    			array(
    				'id' => $prefix . 'image_advanced_1',
    				'type' => 'image_advanced',
    				'name' => esc_html__( 'Image Advanced', 'metabox-online-generator' ),
    			),
    		),
    	);
    
    	return $meta_boxes;
    }
    add_filter( 'rwmb_meta_boxes', 'your_prefix_get_meta_box' );

    Thanks

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi,

    The 1st parameter of the “rwmb_meta” function should be your field ID. In this case it is ‘prefix-image_advanced_1’. Please change the code to:

    <!-- Metabox pic -->
    <?php
    
    $images = rwmb_meta( 'prefix-image_advanced_1', 'type=image_advanced&size=full' );
    foreach ( $images as $image ) {
        echo "<img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' />";
    }
    
    ?>

    thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Advanced Images doesnt seem’ is closed to new replies.