/** * Functions that run on init * * @since 2.0.0 */ public function init() { // Override editor logo add_filter('vc_nav_front_logo', array($this, 'nav_logo')); // Remove templatera notice remove_action('admin_notices', 'templatera_notice'); // Set defaults for admin if (function_exists('vc_set_default_editor_post_types')) { vc_set_default_editor_post_types(array('page', 'portfolio', 'staff', 'templatera')); } // Set defaults for editor if (function_exists('vc_editor_set_post_types ')) { $types = vc_settings()->get('content_types'); if (empty($types)) { vc_editor_set_post_types(array('page', 'portfolio', 'staff')); } } // Array of elements to remove $elements = array('vc_teaser_grid', 'vc_posts_grid', 'vc_posts_slider', 'vc_carousel', 'vc_gallery', 'vc_wp_text', 'vc_wp_pages', 'vc_wp_links', 'vc_wp_categories', 'vc_wp_meta', 'vc_images_carousel'); // Add filter for child theme tweaking $elements = apply_filters('wpex_vc_remove_elements', $elements); // Loop through elements to remove and remove them if (is_array($elements)) { foreach ($elements as $element) { vc_remove_element($element); } } // Add param to tabs vc_add_param('vc_tabs', array('type' => 'dropdown', 'heading' => esc_html__('Style', 'total'), 'param_name' => 'style', 'value' => array(esc_html__('Default', 'total') => 'default', esc_html__('Alternative #1', 'total') => 'alternative-one', esc_html__('Alternative #2', 'total') => 'alternative-two'))); // Add param Tours vc_add_param('vc_tour', array('type' => 'dropdown', 'heading' => esc_html__('Style', 'total'), 'param_name' => 'style', 'value' => array(esc_html__('Default', 'total') => 'default', esc_html__('Alternative #1', 'total') => 'alternative-one', esc_html__('Alternative #2', 'total') => 'alternative-two'))); // Include custom modules if (function_exists('vc_lean_map') && wpex_get_mod('extend_visual_composer', true)) { $this->total_custom_vc_shortcodes(); } }
/** * Initialize plugin data * @return VcTemplateManager */ function init() { if ($this->init) { return $this; } // Disable double initialization. $this->init = true; if (current_user_can('manage_options') && isset($_GET['action']) && $_GET['action'] === 'export_templatera') { $id = isset($_GET['id']) ? $_GET['id'] : null; add_action('wp_loaded', array_map(array(&$this, 'export'), array($id))); } elseif (current_user_can('manage_options') && isset($_GET['action']) && $_GET['action'] === 'import_templatera') { add_action('wp_loaded', array(&$this, 'import')); } $this->createPostType(); $this->initPluginLoaded(); // init filters/actions and hooks // Add vc template post type into the list of allowed post types for visual composer. if ($this->isValidPostType()) { $pt_array = get_option('wpb_js_content_types'); if (!is_array($pt_array) || empty($pt_array)) { $pt_array = array(self::postType(), 'page'); update_option('wpb_js_content_types', $pt_array); } elseif (!in_array(self::postType(), $pt_array)) { $pt_array[] = self::postType(); update_option('wpb_js_content_types', $pt_array); } vc_set_default_editor_post_types(array('page', 'templatera')); vc_editor_set_post_types(vc_editor_post_types() + array('templatera')); add_action('admin_init', array(&$this, 'createMetaBox'), 1); add_filter('vc_role_access_with_post_types_get_state', '__return_true'); add_filter('vc_role_access_with_backend_editor_get_state', '__return_true'); add_filter('vc_role_access_with_frontend_editor_get_state', '__return_true'); add_filter('vc_check_post_type_validation', '__return_true'); } add_action('wp_loaded', array($this, 'createShortcode')); return $this; // chaining. }
/** * Alter default post types * * @since 2.0.0 */ public function init() { // Remove templatera notice remove_action('admin_notices', 'templatera_notice'); // Set as theme mode if (function_exists('vc_set_as_theme') && $this->vc_theme_mode) { vc_set_as_theme(true); } // Set defaults for admin if (function_exists('vc_set_default_editor_post_types')) { vc_set_default_editor_post_types(array('page', 'portfolio', 'staff')); } // Set defaults for editor if (function_exists('vc_editor_set_post_types ')) { $types = vc_settings()->get('content_types'); if (empty($types)) { vc_editor_set_post_types(array('page', 'portfolio', 'staff')); } } // Array of elements to remove $elements = array('vc_teaser_grid', 'vc_posts_grid', 'vc_posts_slider', 'vc_carousel', 'vc_gallery', 'vc_wp_text', 'vc_wp_pages', 'vc_wp_links', 'vc_wp_categories', 'vc_wp_meta', 'vc_images_carousel'); // Add filter for child theme tweaking $elements = apply_filters('wpex_vc_remove_elements', $elements); // Loop through elements to remove and remove them if (is_array($elements)) { foreach ($elements as $element) { vc_remove_element($element); } } // Add param to tabs vc_add_param('vc_tabs', array('type' => 'dropdown', 'heading' => __('Style', 'wpex'), 'param_name' => 'style', 'value' => array(__('Default', 'wpex') => 'default', __('Alternative #1', 'wpex') => 'alternative-one', __('Alternative #2', 'wpex') => 'alternative-two'))); // Add param Tours vc_add_param('vc_tour', array('type' => 'dropdown', 'heading' => __('Style', 'wpex'), 'param_name' => 'style', 'value' => array(__('Default', 'wpex') => 'default', __('Alternative #1', 'wpex') => 'alternative-one', __('Alternative #2', 'wpex') => 'alternative-two'))); // Add param Custom Heading vc_add_param('vc_custom_heading', array('type' => 'dropdown', 'heading' => __('Enqueue Font Style', 'wpex'), 'param_name' => 'enqueue_font_style', 'value' => array(__('Yes', 'wpex') => 'true', __('No', 'wpex') => 'false'), 'descriptipn' => __('If the Google Font you are using is already in use by the theme select No to prevent this font from loading again on the site.', 'wpex'))); }
<?php $list = array('page', 'post', 'portfolio', 'product', 'uncodeblock'); vc_editor_set_post_types($list); require_once 'config/uncode_map.php'; require_once 'remove_components.php'; require_once 'add_components.php'; function uncode_custom_css_classes_for_vc_row_and_vc_column($class_string, $tag) { if ($tag == 'vc_row' || $tag == 'vc_row_inner') { $class_string = str_replace('vc_row-fluid', 'row', $class_string); } if ($tag == 'vc_column' || $tag == 'vc_column_inner') { $class_string = preg_replace('/vc_col-sm-(\\d{1,2})/', 'col-lg-$1', $class_string); } return $class_string; } // Filter to Replace default css class for vc_row shortcode and vc_column add_filter('vc_shortcodes_css_class', 'uncode_custom_css_classes_for_vc_row_and_vc_column', 10, 2); function uncode_init_custom_vc() { require_once 'config/override_map.php'; } add_action('admin_init', 'uncode_init_custom_vc'); function uncode_init_custom_js() { wp_enqueue_style('vc-admin', plugins_url('assets/css/vc_admin.css', __FILE__), false); wp_enqueue_script('uncode-admin-fix-inputs', plugins_url('assets/js/fix_inputs.js', __FILE__), false); wp_enqueue_script('uncode-admin-index-items', plugins_url('assets/js/index_items.js', __FILE__), false); wp_enqueue_script('uncode-admin-media-elements', plugins_url('assets/js/media_element.js', __FILE__), false); wp_enqueue_script('uncode-admin-extend', plugins_url('assets/js/js_composer_extend.js', __FILE__), false);