latest version

FAQ - Developers Questions

Theme Plugin

Error after activating theme plugin: Cannot redeclare class ctBeePlugin?

It means there is more than one theme plugin activated. Please deactivate all theme plugins (or all plugins in general), then activate the theme plugin again.

How to update framework files?

Run composer update in theme plugin directory terminal. Just like in this example:

../../_images/composer-install.png

Visual Composer

How to add/modify an option to an existing Visual Composer shortcode?

There are two possible scenarios

  1. Add new param to a shortcode (eg. new select input)

    1. Open theme-plugin/extensions/visual-composer/hooks.php

    2. Add _filter_fw_visual_composer_extend_shortcodes filter hook callback to modify the existing vc shortcode

    3. Example code to add decoration and clound-bgcolor options to vc_section vc shortcode

      add_filter( '_filter_fw_visual_composer_extend_shortcodes', 'fw_ext_visual_composer_extend_shortcodes' );
      function fw_ext_visual_composer_extend_shortcodes( $shortcodes ) {
      
          $shortcodes['vc_section'] = array(
              'decoration' => array(
                  'type' => 'select',
                  'choices' => array(
                      '' => esc_html__( 'None', 'ct_theme' ),
                      'top-cloud' => esc_html__( 'Top Cloud', 'ct_theme' ),
                      'bottom-cloud' => esc_html__( 'Bottom Cloud', 'ct_theme' ),
                      'top-bottom-cloud' => esc_html__( 'Top and Bottom Cloud', 'ct_theme' ),
                  ),
                  'label' => esc_html__( 'Select cloud decoration', 'ct_theme' ),
              ),
              'cloud-bgcolor' => array(
                  'type'     => 'color-picker',
                  'value'    => '#fff',
                  'label'    => esc_html__( 'Cloud Background Color', 'ct_theme' ),
              ),
      
          );
      
          return $shortcodes;
      }
      
  2. Add new options to an existing shortcode param (eg. new style option)

    1. Open theme-plugin/extensions/visual-composer/hooks.php

    2. Add vc_after_init action hook callback to modify the existing vc shortcode param

    3. Example code to add new style param options of vc_single_image vc shortcode

      add_action( 'vc_after_init', 'fw_ext_visual_composer_update_shortcodes' );
      function fw_ext_visual_composer_update_shortcodes() {
      
          // get 'style' param of 'vc_single_image' shortcode
          $param = WPBMap::getParam( 'vc_single_image', 'style' );
      
          // add options
          $param['value'][__( 'Framed', 'ct_theme' )] = 'ct-framed-image';
          $param['value'][__( 'Framed light', 'ct_theme' )] = 'ct-framed-image ct-framed-image--Light';
          $param['value'][__( 'Framed dark', 'ct_theme' )] = 'ct-framed-image ct-framed-image--Dark';
      
          // update the shortcode param
          vc_update_shortcode_param( 'vc_single_image', $param );
      
      }
      

That’s all. If you furthermore need to change the markup of a VC shortcode, read below.

How to change the markup of a VC shortcode?

Just create vc_templates folder in your theme root folder and copy and modify vc shortcode templates there, ie. wp-content/themes/project_name/theme/vc_templates/vc_single_image.php. Read more.

General

The link of single custom post type page doesn’t work or redirects to homepage

You may need to rebuild the permalinks. Go to Settings -> Permalinks and press save.

(supports) I’m trying to work on a legacy theme however files are missing

After checking out the theme, run composer update in main theme directory.

Composer update doesn’t work

Please make sure you have a valid ssh key entered here https://gitlab.createit.pl/profile/keys . If not, follow the instructions to generate one.

After you add the key, run below command in git bash:

ssh -T git@gitlab.createit.pl

If asked to add host, type yes and press enter.

How to make shortcodes (like CF7) render in widget areas?

Add this filter to theme-plugin/extensions/shortcodes/hooks.php

// parse all text in widget text as shortcodes
add_filter( 'widget_text', 'do_shortcode' );