dimension images for complex fields
-
hi,
i want to build a slider with complex fields of carbon fields. my code is here :
Container::make('post_meta', 'Slider Reference decoration') ->set_context('normal') ->set_priority('high') ->show_on_post_type('decoration') ->add_fields(array( Field::make('complex', 'crb_slider_references_deco')->add_fields(array( Field::make("image", "Image")->set_value_type('url')->help_text('Pour la bonne tenue du slider choisir une image aux dimensions suivantes : 1920px X 700px') )) ));in my template, i’m using the code in the documentation of the plugin :
<?php $slidesDeco = carbon_get_post_meta(get_the_ID(),'crb_slider_references_deco', 'complex'); if ( $slidesDeco ) { foreach ($slidesDeco as $slide) { ?> <div><img src="<?php echo $slide['image'] ?>" alt="slider"></div> <?php } } ?>i want to specify a size for my images in the slider. in my code, the variable $slide must have an argument for put custom size (1920px x 700px)
i try with wp_get_attachment_src but it doesn’t work. i don’t understand
$slidesDeco = carbon_get_post_meta(get_the_ID(),'crb_slider_references_deco', 'complex'); $images = wp_get_attachment_image_src( $slidesDeco, array( 1920, 700 ) ); foreach ($images as $image) { ?> ...slider... <?php } ?>but the function wp_get_attachment_image_src return a false response. i think the first argument it’s an array($slidesDeco) and
for the operation of the function it is not possible.have you an idea for my problem
thanks so lot
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘dimension images for complex fields’ is closed to new replies.