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

Posted

tags:

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

<?php

  // VC statistic add-ons

   vc_map( 
        array(
          "name" => esc_html__( "Stock Statistic Box", "stock-toolkit" ),
          "base" => "stock_statistic",
          "category" => esc_html__( "Stock", "stock-toolkit"),
          "params" => array(
             array(
                "type" => "textfield",
                "heading" => esc_html__( "Statistic number", "stock-toolkit" ),
                "param_name" => "number", 
                "description" => esc_html__( "", "stock-toolkit" ),
             ),
             array(
                "type" => "textfield",
                "heading" => esc_html__( "Statistic number after text", "stock-toolkit" ),
                "param_name" => "after_text",
                "description" => esc_html__( "", "stock-toolkit" ),
             ),
             array(
                "type" => "textfield",
                "heading" => esc_html__( "Statistic description", "stock-toolkit" ),
                "param_name" => "desc",
                "description" => esc_html__( "", "stock-toolkit" ),
             ),
          )
       ) 
   );

<?php

// Statistic shortcode

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

    extract( shortcode_atts( array(
        'number' => 1,
        'after_text' => '',
        'desc' => '',
    ), $atts) );



    $stock_statistic_markup = '
        <div class="stock-statistic-box">
            <h1>
                <span>'.esc_attr($number).'</span>
                '.esc_html($after_text).'
            </h1>
            '.esc_html($desc).'
        </div>
    ';


    return $stock_statistic_markup;


}
add_shortcode('stock_statistic', 'stock_statistic_shortcode' );

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

php 推荐短信和vc附加组件

php 号召性用语短信和vc附加组件

php 标题库短代码和vc插件

如何在 VC++ 项目中强制附加包含文件搜索顺序?

php [WooCommerce Ninja Forms产品附加组件]隐藏价格附加组件等于零

php base functions.php附加组件