php 号召性用语短信和vc附加组件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 号召性用语短信和vc附加组件相关的知识,希望对你有一定的参考价值。
<?php
//Call to action add-ons
vc_map(
array(
"name" => esc_html__( "Stock Call to Action", "stock-toolkit" ),
"base" => "stock_cta",
"category" => esc_html__( "Stock", "stock-toolkit"),
"params" => array(
array(
"type" => "textfield",
"heading" => esc_html__( "Title", "stock-toolkit" ),
"param_name" => "title",
"description" => esc_html__( "", "stock-toolkit" )
),
array(
"type" => "textarea",
"heading" => esc_html__( "Content", "stock-toolkit" ),
"param_name" => "desc",
"description" => esc_html__( "", "stock-toolkit" )
),
array(
"type" => "dropdown",
"heading" => esc_html__( "Theme", "stock-toolkit" ),
"param_name" => "theme",
"std" => esc_html__( "1", "stock-toolkit" ),
"value" => array(
esc_html__('General Theme','stock-toolkit') => 1,
esc_html__('Color Theme','stock-toolkit') => 2,
),
"description" => esc_html__( "", "stock-toolkit" ),
),
array(
"type" => "dropdown",
"heading" => esc_html__( "Link type", "stock-toolkit" ),
"param_name" => "type",
"std" => esc_html__( "1", "stock-toolkit" ),
"value" => array(
esc_html__('Link to page','stock-toolkit') => 1,
esc_html__('External link','stock-toolkit') => 2,
),
"description" => esc_html__( "", "stock-toolkit" ),
),
array(
"type" => "dropdown",
"heading" => esc_html__( "Link to page", "stock-toolkit" ),
"param_name" => "link_to_page",
"value" => stock_toolkit_get_page_as_list(),
"description" => esc_html__( "", "stock-toolkit" ),
"dependency" => array(
"element" => "type",
"value" => array("1"),
)
),
array(
"type" => "textfield",
"heading" => esc_html__( "External link", "stock-toolkit" ),
"param_name" => "external_link",
"description" => esc_html__( "", "stock-toolkit" ),
"dependency" => array(
"element" => "type",
"value" => array("2"),
)
),
array(
"type" => "textfield",
"heading" => esc_html__( "Link text", "stock-toolkit" ),
"param_name" => "link_text",
"std" => esc_html__( "See more", "stock-toolkit" ),
"description" => esc_html__( "", "stock-toolkit" ),
),
)
)
);
<?php
// Call to action shortcode
function stock_cta_shortcode($atts, $content = null){
extract( shortcode_atts( array(
'title' => '',
'desc' => '',
'type' => 1,
'link_to_page' => '',
'theme' => 1,
'external_link' => '',
'link_text' => esc_html('Start a project','stock-toolkit'),
), $atts) );
if($type == 1){
$link_source = get_page_link($link_to_page);
}else{
$link_source = $external_link;
}
$stock_cta_desc_allowed_tags =
array(
'a' => array(
'href' => array(),
'title' => array()
),
'img' => array(
'alt' => array(),
'title' => array()
),
'br' => array(),
'em' => array(),
'strong' => array(),
'p' => array()
);
$stock_cta_markup = '
<div class="stock-cta-box stock-cta-box-theme-'.esc_attr($theme).'">
<h2>'.esc_html($title).'</h2>
'.wp_kses(wpautop($desc), $stock_cta_desc_allowed_tags ).'
<a href="'.esc_url($link_source).'" class="bordered-btn">'.esc_html($link_text).'</a>
</div>
';
$stock_cta_markup .= '';
return $stock_cta_markup;
}
add_shortcode('stock_cta', 'stock_cta_shortcode' );
以上是关于php 号召性用语短信和vc附加组件的主要内容,如果未能解决你的问题,请参考以下文章
html 有效的号召性用语。有效的“号召性用语”按钮或链接需要考虑一些角色。页面上的位置,