php 标题库短代码和vc插件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 标题库短代码和vc插件相关的知识,希望对你有一定的参考价值。

<?php

  // Tile gallery add-ons

   vc_map( 
	   	array(
	      "name" => esc_html__( "Stock Tile Gallery", "stock-toolkit" ),
	      "base" => "stock_tile_gallery",
	      "category" => esc_html__( "Stock", "stock-toolkit"),
	      "params" => array(
	         array(
	            "type" => "attach_images",
	            "heading" => esc_html__( "Upload Gallery Images", "stock-toolkit" ),
	            "param_name" => "images",
	            "description" => esc_html__( "", "stock-toolkit" )
	         ),
	         array(
	            "type" => "textfield",
	            "heading" => esc_html__( "Height", "stock-toolkit" ),
	            "param_name" => "height",
	            "std" => esc_html__( "310", "stock-toolkit" ),
	            "description" => esc_html__( "Type image height as numeric value", "stock-toolkit" ),
	         )
	      )
	   ) 
   );

<?php

// Tile gallery shortcode

function stock_tile_gallery_shortcode($atts, $content = null){

	extract( shortcode_atts( array(
        'images' => '',  
        'height' => '310',
        'size' => 'large',
    ), $atts) );

    $image_ids = explode(',', $images);
    $logo_count = count($image_ids);
    $image_no = 0;


    if(!empty($images)){
        $stock_tile_gallery_markup = '
            <div class="stock-tile-gallery stock-tile-gallery-image-'.esc_attr($logo_count).'">';

            foreach($image_ids as $image){
                $image_array = wp_get_attachment_image_src($image, $size);
                $image_no++;
                $stock_tile_gallery_markup .= '<div style="background-image:url('.esc_url($image_array[0]).'); height:'.$height.'px" class="tile-galery-block tile-galery-block-'.$image_no.'"></div>';
            }

                $stock_tile_gallery_markup .= '
            </div>
        ';
    }else{
        $stock_tile_gallery_markup = '';
    }


    return $stock_tile_gallery_markup;


}
add_shortcode('stock_tile_gallery', 'stock_tile_gallery_shortcode' );

以上是关于php 标题库短代码和vc插件的主要内容,如果未能解决你的问题,请参考以下文章

PHP 使用帖子附件的Wordpress图像库短代码

vc code

php 按钮短代码和vc附加组件

php 统计短代码和vc附加组件

使用 VC++ 创建 Excel 自动化插件

求助:hmailserver+roundcube启用密码插件后,用户无法修改密码问题