如何在kingcomposer wordpress页面生成器插件中添加自定义主题内容?我想在kingcomposer中添加自定义内容。
您可以在自定义主题中轻松集成KingComposer插件。遵循以下说明-
本说明可帮助您将网站与任何主题和KingComposer页面生成器集成。
管理元素
- 通过页面添加插件安装Kingcomposer插件
- 创建文件并通过function.php包含在您的主题中
我在inc/kc_element.php 文件夹中创建了文件kc_eelement.php
我通过文件功能调用它.php
需要get_template_directory()。'/inc/kc_element.php’;
global $kc;
$kc->add_map(
array(
'element_id' => array(
'name' => __( 'Text Title', 'domain' ),
'description' => __( 'Display text and description', 'domain' ),
'category' => __( 'Twenty_Sixteen', 'domain' ),
'icon' => 'fa-header',
'params' => array(
array(
'name' => 'title',
'label' => __( 'Title', 'domain' ),
'type' => 'text',
'description' => __( 'Insert text title', 'domain' ),
'value' => 'Insert Title',
'admin_label' => true
),
array(
'name' => 'desc',
'label' => __( 'Description', 'domain' ),
'type' => 'editor',
'description' => __( 'Text description', 'domain' ),
'value' => base64_encode( 'Insert Content' )
),
)
)
)
);
前端元件:
- 创建短代码文件并通过function.php包含在您的主题中
我在inc/kc_shortcode.php 文件夹中创建了文件kc_shortcode.php
我通过文件功能调用它.php
需要get_template_directory()。'/inc/kc_shortcode.php’;
add_shortcode( 'element_id', 'element_Function' );
function element_Function( $atts ){
$title = $desc = '';
extract( $atts );
echo $title;
echo $desc;
}
查看它了解更多关于King Composer插件的信息。king composer插件中所有类型都可用http://docs.kingcomposer.com/getting-started/installation/
感谢
您可以通过以下代码轻松添加您的帖子类型:
global $kc;
// add single content type
$kc->add_content_type( 'your-post-type-name' );
// add multiple content types
$kc->add_content_type( array( 'type-1', 'type-2' ) );
希望这是有道理的。