如何添加我的主题内容King composer wordpress页面构建器插件?

时间:2017-01-04 15:45:25

标签: wordpress

如何在kingcomposer wordpress页面构建器插件中添加自定义主题内容?我想在kingcomposer中添加自定义内容。

2 个答案:

答案 0 :(得分:1)

您可以轻松地将KingComposer插件集成到自定义主题中。请遵循以下说明 -

此说明可帮助您将网站与任何主题和KingComposer页面构建器集成。

管理元素

  1. 通过页面添加插件安装Kingcomposer插件
  2. 创建文件并在主题中包含via function.php
  3. 我在文件夹inc / kc_element.php中创建了文件kc_element.php

    我通过文件function.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' )
                        ),
                    )
                )
            )
        );
    

    前端元素:

    1. 创建短代码文件并在主题中包含via function.php
    2. 我在文件夹inc / kc_shortcode.php中创建了文件kc_shortcode.php

      我通过文件function.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插件的更多信息。 在王作曲家插件http://docs.kingcomposer.com/getting-started/installation/

      中提供所有类型

      感谢
      BanyanTheme

答案 1 :(得分:0)

您可以通过以下代码轻松添加帖子类型:

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' ) );

希望有意义。

相关问题