Php 如何在前端wordpress的Visual Composer中显示新图像?
我正在使用VisualComposer,我在使用此代码时在后端添加了新字段Php 如何在前端wordpress的Visual Composer中显示新图像?,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我正在使用VisualComposer,我在使用此代码时在后端添加了新字段 array( "type" => "attach_images", "heading" => __("Flag Upload", "js_composer"), "param_name" => "flag_image_id", "value" => "", "description" => "" ), 它是令人担忧的罚款在后端,但现在我被困在如何显示
array(
"type" => "attach_images",
"heading" => __("Flag Upload", "js_composer"),
"param_name" => "flag_image_id",
"value" => "",
"description" => ""
),
它是令人担忧的罚款在后端,但现在我被困在如何显示这个领域在前端
我附上更多的了解图像
下面将获得您的标志图像信息,您只需将其插入到输出html框中即可
//Image information for any pictures.
// Gets url of the image
$image_attributes = wp_get_attachment_image_src( $flag_image_id );
// Gets the Image Alt
$image_alt = get_post_meta($flag_image_id, '_wp_attachment_image_alt', true);
// Gets the image name with exstention
$image_filename = basename ( get_attached_file( $flag_image_id ) );
// Gets the image name without exstention
$image_title = get_the_title( $flag_image_id );
function designas_partners(){
//头衔
vc_图(
排列(
“名称”=>“(“客户端”),
“基本”=>“指定合作伙伴内容”,
“类别”=>(简单组件),
“params”=>数组(
排列(
“键入”=>“附加图像”,
“heading”=>esc_html_uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu,
“description”=>esc_html_uuuu(“添加客户端图像”、“appcastle核心”),
“参数名称”=>“屏幕截图”,
“值”=>“”,
),
)
)
);
}
添加行动('vc_before_init','designas_partners');
函数指定为\u合作伙伴\u内容\u函数($atts,$content){
$gallery=短代码\u附件(
排列(
“截图”=>“截图”,
)(港币),;
$image_id=explode(“,”,$gallery['screenshots');
$return=
';
foreach($image\u id作为$image\u id){
$images=wp_get_attachment_image_src($image_id,'company_logo');
$return.='';
$images++;
}
$return.='';
return$return;
}
添加快捷码('designas\u partners\u content'、'designas\u partners\u content\u function')
function designas_partners() {
// Title
vc_map(
array(
'name' => __( 'Clients' ),
'base' => 'designas_partners_content',
'category' => __( 'Easy Component' ),
'params' => array(
array(
"type" => "attach_images",
"heading" => esc_html__( "Add Clients Images", "appcastle-core" ),
"description" => esc_html__( "Add Clients Images", "appcastle-core" ),
"param_name" => "screenshots",
"value" => "",
),
)
)
);
}
add_action( 'vc_before_init', 'designas_partners' );
function designas_partners_content_function( $atts, $content ) {
$gallery = shortcode_atts(
array(
'screenshots' => 'screenshots',
), $atts );
$image_ids = explode(',',$gallery['screenshots']);
$return = '
<div class="clients">';
foreach( $image_ids as $image_id ){
$images = wp_get_attachment_image_src( $image_id, 'company_logo' );
$return .='<div class="images"><img src="'.$images[0].'" alt="'.$atts['title'].'"></div>';
$images++;
}
$return .='</div>';
return $return;
}
add_shortcode( 'designas_partners_content', 'designas_partners_content_function' )