PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, January 6, 2022

[FIXED] how to add my theme content King composer wordpress page builder plugin?

 January 06, 2022     wordpress     No comments   

Issue

How to add custom theme content in kingcomposer wordpress page builder plugin?I want to add custom content in kingcomposer.


Solution

You can easily integrate KingComposer plugin in your custom theme. Follow below instruction-

This instruction helps you integrate your website with any theme and KingComposer page builder.

Admin elements

  1. Install Kingcomposer plugin via page added plugin
  2. Creat file and include via function.php in your theme

I created file kc_element.php in folder inc/kc_element.php

I call it via file function.php

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

Front-end elements:

  1. Creat shortcode file and include via function.php in your theme

I created file kc_shortcode.php in folder inc/kc_shortcode.php

I call it via file function.php

require 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;

}

Check it know more about King Composer plugin. Available all type in king composer plugin http://docs.kingcomposer.com/getting-started/installation/

Thanks



Answered By - Jilani A
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing