[英]How to show image on front end WordPress page by visual composer?
function italy_menu( $menu1, $menu2 ){
ob_start();
$menuatts = shortcode_atts(array(
'menu_image' => '',
'menu_title' => '',
'menu_money' => '',
), $menu1 );
?>
<div class="post">
<a href="#"><img src="<?php echo $menuatts['menu_image']; ?>"/></a>
<div class="wrapper">
<h5><a href="#"><?php echo $menuatts['menu_title']; ?></a></h5>
<span><?php echo $menuatts['menu_money']; ?></span>
</div>
</div>
<?php
return ob_get_clean();
}
add_shortcode('menu','italy_menu');
if(function_exists(vc_map)){
vc_map(array(
'name' => 'Italy Food Menu',
'base' => 'menu',
'params' => array(
array(
'param_name' => 'menu_image',
'type' => 'attach_images',// How to show image on front page.
'heading' => 'Menu Image'
),
array(
'param_name' => 'menu_title',
'type' => 'textfield',
'heading' => 'Menu Title'
),
array(
'param_name' => 'menu_money',
'type' => 'textfield',
'heading' => 'Menu Money'
),
)
));
}
How to show image on front end WordPress page by visual composer ? 如何通过视觉作曲家在前端WordPress页面上显示图像? I want to show image on my front-end by visual composer. 我想由视觉作曲家在前端显示图像。 I am using > 'type' => 'attach_images',
But its not showing the image... Here is my code. 我正在使用> 'type' => 'attach_images',
但是它没有显示图像...这是我的代码。
$gallery = shortcode_atts( array( 'post_gallery' => 'post_gallery', ), $atts ); $ gallery = shortcode_atts(array('post_gallery'=>'post_gallery',),$ atts);
$image_ids=explode(',',$gallery['post_gallery']);
$sigle_img = wp_get_attachment_image_src($image_ids[0], "large");
$img="<div id='tourGallery'><img class='imgthumb' id='' src='".$sigle_img[0]."' style='width:100%' alt=''></div><div id='galleryThumbs'>";
for($i=0;$i<=9;$i++)
{
if($image_ids[$i]!="")
{
$imgs = wp_get_attachment_image_src($image_ids[$i], "large");
$img.="<div><img class='imgthumb' id='' src='".$imgs[0]."' style='width:100%' alt=''></div>";
}
}
$img.="</div></div>";
return $img;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.