function ewf_load_composer() { if (function_exists('vc_set_as_theme')) { vc_set_as_theme(); } if (function_exists('vc_set_template_dir')) { $dir = get_template_directory() . '/framework/composer/templates/'; vc_set_template_dir($dir); } if (function_exists('vc_disable_frontend')) { vc_disable_frontend(); } add_filter('vc_shortcodes_css_class', 'ewf_composer_custom_classes', 10, 2); }
function visual_composer_stuff() { if (function_exists('vc_set_as_theme')) { vc_set_as_theme(true); } vc_disable_frontend(); // Modify and remove existing shortcodes from VC include_once 'inc/shortcodes/visual-composer/custom_vc.php'; // VC Templates $vc_templates_dir = get_template_directory() . '/inc/shortcodes/visual-composer/vc_templates/'; vc_set_template_dir($vc_templates_dir); // Add new shortcodes to VC include_once 'inc/shortcodes/visual-composer/from-the-blog.php'; include_once 'inc/shortcodes/visual-composer/social-media-profiles.php'; include_once 'inc/shortcodes/visual-composer/banner.php'; include_once 'inc/shortcodes/visual-composer/title.php'; // Add new Shop shortcodes to VC if (class_exists('WooCommerce')) { include_once 'inc/shortcodes/visual-composer/wc-recent-products.php'; include_once 'inc/shortcodes/visual-composer/wc-featured-products.php'; include_once 'inc/shortcodes/visual-composer/wc-products-by-category.php'; include_once 'inc/shortcodes/visual-composer/wc-products-by-attribute.php'; include_once 'inc/shortcodes/visual-composer/wc-product-by-id-sku.php'; include_once 'inc/shortcodes/visual-composer/wc-products-by-ids-skus.php'; include_once 'inc/shortcodes/visual-composer/wc-sale-products.php'; include_once 'inc/shortcodes/visual-composer/wc-top-rated-products.php'; include_once 'inc/shortcodes/visual-composer/wc-best-selling-products.php'; include_once 'inc/shortcodes/visual-composer/wc-add-to-cart-button.php'; include_once 'inc/shortcodes/visual-composer/wc-product-categories.php'; include_once 'inc/shortcodes/visual-composer/wc-product-categories-grid.php'; } // Add new Options function add_vc_text_separator_no_border() { $param = WPBMap::getParam('vc_text_separator', 'style'); $param['value'][__('No Border', 'mr_tailor')] = 'no_border'; WPBMap::mutateParam('vc_text_separator', $param); } add_action('init', 'add_vc_text_separator_no_border'); // Remove vc_teaser if (is_admin()) { function remove_vc_teaser() { remove_meta_box('vc_teaser', '', 'side'); } add_action('admin_head', 'remove_vc_teaser'); } }
function visual_composer_stuff() { //enable vc on post types if (function_exists('vc_set_default_editor_post_types')) { vc_set_default_editor_post_types(array('post', 'page', 'product', 'portfolio')); } if (function_exists('vc_set_as_theme')) { vc_set_as_theme(true); } //vc_disable_frontend(); // Modify and remove existing shortcodes from VC include_once 'inc/shortcodes/visual-composer/custom_vc.php'; // VC Templates $vc_templates_dir = get_template_directory() . '/inc/shortcodes/visual-composer/vc_templates/'; vc_set_template_dir($vc_templates_dir); // Add new shortcodes to VC include_once 'inc/shortcodes/visual-composer/from-the-blog.php'; include_once 'inc/shortcodes/visual-composer/social-media-profiles.php'; include_once 'inc/shortcodes/visual-composer/google-map.php'; include_once 'inc/shortcodes/visual-composer/banner.php'; include_once 'inc/shortcodes/visual-composer/icon-box.php'; include_once 'inc/shortcodes/visual-composer/portfolio.php'; // Add new Shop shortcodes to VC if (class_exists('WooCommerce')) { include_once 'inc/shortcodes/visual-composer/wc-recent-products.php'; include_once 'inc/shortcodes/visual-composer/wc-featured-products.php'; include_once 'inc/shortcodes/visual-composer/wc-products-by-category.php'; include_once 'inc/shortcodes/visual-composer/wc-products-by-attribute.php'; include_once 'inc/shortcodes/visual-composer/wc-product-by-id-sku.php'; include_once 'inc/shortcodes/visual-composer/wc-products-by-ids-skus.php'; include_once 'inc/shortcodes/visual-composer/wc-sale-products.php'; include_once 'inc/shortcodes/visual-composer/wc-top-rated-products.php'; include_once 'inc/shortcodes/visual-composer/wc-best-selling-products.php'; include_once 'inc/shortcodes/visual-composer/wc-add-to-cart-button.php'; include_once 'inc/shortcodes/visual-composer/wc-product-categories.php'; include_once 'inc/shortcodes/visual-composer/wc-product-categories-grid.php'; } // Remove vc_teaser if (is_admin()) { function remove_vc_teaser() { remove_meta_box('vc_teaser', '', 'side'); } add_action('admin_head', 'remove_vc_teaser'); } }
<?php /*-----------------------------------------------------------------------------------*/ /* SD Visual Composer Functions /*-----------------------------------------------------------------------------------*/ // change VC templates dir $dir = SD_FRAMEWORK_INC . 'vc/vc-templates/'; vc_set_template_dir($dir); // Set Visual Composer to run in Theme Mode if (function_exists('vc_set_as_theme')) { function sd_vc_as_theme() { vc_set_as_theme(true); } add_action('init', 'vc_set_as_theme'); if (!function_exists('sd_disable_vc_front_end')) { function sd_disable_vc_front_end() { if (function_exists('vc_disable_frontend')) { } else { return; } } } add_action('init', 'sd_disable_vc_front_end'); } // disable frontend mode (still in beta) vc_disable_frontend(); // remove params and elements require_once SD_FRAMEWORK_INC . 'vc/sd-vc-remove.php'; // update params
*/ if (function_exists('vc_set_as_theme')) { vc_set_as_theme($disable_updater = true); // Disable frontend editor by default - to re-enable just comment out the next line vc_disable_frontend(); } // Initialising Shortcodes if (class_exists('WPBakeryVisualComposerAbstract')) { function requireVcExtend() { require_once locate_template('/customvc/vc_extend.php'); } add_action('init', 'requireVcExtend', 2); // Set VC tpl override directory $vcdir = get_stylesheet_directory() . '/customvc/vc_templates/'; vc_set_template_dir($vcdir); // Remove VC nag looking for key - CommerceGurus has an extended lic. if (is_admin()) { function remove_vc_nag() { remove_meta_box('vc_teaser', '', 'side'); } add_action('admin_head', 'remove_vc_nag'); } } /** * Sets up theme defaults and registers support for various WordPress features. */ if (!function_exists('cg_setup')) { function cg_setup() {
<?php /** * Load custom VC shortcodes */ if (class_exists('WPBakeryVisualComposerAbstract')) { // VC Templates $vc_templates_dir = get_template_directory() . '/shortcodes/visual-composer/vc_templates/'; vc_set_template_dir($vc_templates_dir); // Add new Shop shortcodes to VC if (class_exists('WooCommerce')) { include_once 'shortcodes/visual-composer/woo-recent-products.php'; include_once 'shortcodes/visual-composer/woo-featured-products.php'; include_once 'shortcodes/visual-composer/woo-products-by-category.php'; include_once 'shortcodes/visual-composer/woo-products-by-attribute.php'; include_once 'shortcodes/visual-composer/woo-product-by-id-sku.php'; include_once 'shortcodes/visual-composer/woo-products-by-ids-skus.php'; include_once 'shortcodes/visual-composer/woo-sale-products.php'; include_once 'shortcodes/visual-composer/woo-top-rated-products.php'; include_once 'shortcodes/visual-composer/woo-best-selling-products.php'; include_once 'shortcodes/visual-composer/woo-product-categories.php'; } include_once 'shortcodes/visual-composer/mmm-menu.php'; } include_once 'shortcodes/wp/recent-products-wp.php'; include_once 'shortcodes/wp/featured-products-wp.php'; include_once 'shortcodes/wp/sale-products-wp.php'; include_once 'shortcodes/wp/best-selling-products-wp.php'; include_once 'shortcodes/wp/products-by-category-wp.php'; include_once 'shortcodes/wp/products-wp.php'; include_once 'shortcodes/wp/products-by-attribute-wp.php';
<?php if (function_exists('vc_set_as_theme')) { /* Set Theme */ vc_set_as_theme(true); /* Disable Front-End */ vc_disable_frontend(); /* Set Default Value */ vc_set_default_editor_post_types(array('post', 'page', 'portfolio', 'team')); /* Set templates directory */ vc_set_template_dir(get_template_directory() . '/vc_extend/vc_templates/'); /* Include proper files */ include 'dependencies.php'; include 'map.php'; /* Remove some elements */ vc_remove_element('vc_wp_search'); vc_remove_element('vc_wp_meta'); vc_remove_element('vc_wp_recentcomments'); vc_remove_element('vc_wp_calendar'); vc_remove_element('vc_wp_pages'); vc_remove_element('vc_wp_tagcloud'); vc_remove_element('vc_wp_custommenu'); vc_remove_element('vc_wp_text'); vc_remove_element('vc_wp_posts'); vc_remove_element('vc_wp_links'); vc_remove_element('vc_wp_categories'); vc_remove_element('vc_wp_archives'); vc_remove_element('vc_wp_rss'); vc_remove_element('vc_widget_sidebar'); vc_remove_element('vc_button'); vc_remove_element('vc_button2');
return WpbakeryShortcodeParams::addField($name, $form_field_callback, $script_url); // $check = WpbakeryShortcodeParams::addField( $name, $form_field_callback, $script_url ); // print_r($check);die(); } } if (function_exists("vc_map")) { require PR_THEME_PATH . 'core/vc-elements/extra_shorcodes.php'; } if (function_exists("add_extra_field")) { require PR_THEME_PATH . 'core/vc-elements/extra_fields.php'; } if (function_exists("vc_add_param")) { require PR_THEME_PATH . '/core/vc-elements/extra_params.php'; } if (function_exists("vc_set_template_dir")) { vc_set_template_dir(PR_THEME_PATH . "core/layouts/vc-templetes/vc-customs/"); } #-----------------------------------------------------------------# # Add Style Main # #-----------------------------------------------------------------# function pr_style_main() { // Register wp_register_style('bootstrap.min', get_stylesheet_directory_uri() . '/css/bootstrap.min.css'); wp_register_style('font-awesome', get_stylesheet_directory_uri() . '/css/font-awesome.min.css'); wp_register_style('pretty-photo', get_stylesheet_directory_uri() . '/css/prettyPhoto.css'); wp_register_style('animate', get_stylesheet_directory_uri() . '/css/animate.css'); wp_register_style('astro-animation', get_stylesheet_directory_uri() . '/css/astro-animation.css'); wp_register_style('main-style', get_stylesheet_directory_uri() . '/style.css'); //wp_register_style('responsive', get_stylesheet_directory_uri() . '/assets/css/responsive.css'); wp_register_style('static', get_stylesheet_directory_uri() . '/assets/css/static.css');
add_action('wp_enqueue_scripts', 'cshero_google_font'); add_action('wp_enqueue_scripts', 'cshero_css'); /* * Js */ add_action('wp_enqueue_scripts', 'googleAnalytic'); add_action('wp_enqueue_scripts', 'cshero_js'); /* * Header */ add_action('wp_head', 'cshero_favicon'); /* * VC Template */ if (function_exists("vc_set_template_dir")) { vc_set_template_dir(get_stylesheet_directory() . "/vc_templates/"); } /* * TGM */ require_once ADMIN_PATH . 'tgm-plugin-activation/class-tgm-plugin-activation.php'; require_once ADMIN_PATH . 'tgm-plugin-activation/plugin-options.php'; /* * Favicon */ function cshero_favicon() { global $smof_data; $icon = get_stylesheet_directory_uri() . "/favicon.ico"; if ($smof_data["favicon"]) { $icon = $smof_data["favicon"];
<?php if (function_exists('vc_set_as_theme')) { // Init functions vc_set_as_theme(true); vc_disable_frontend(); vc_set_default_editor_post_types(array('page')); vc_set_template_dir(get_template_directory() . '/includes/vc-extra/vc_templates/'); // Include property files require_once 'vc-dependencies.php'; require_once 'vc-map.php'; // Remove some of the elements //vc_remove_element('vc_posts_grid'); vc_remove_element('vc_accordion'); vc_remove_element('vc_carousel'); vc_remove_element('vc_cta_button'); vc_remove_element('vc_cta_button2'); vc_remove_element('vc_btn'); vc_remove_element('vc_button'); vc_remove_element('vc_button2'); vc_remove_element('vc_facebook'); vc_remove_element('vc_gallery'); vc_remove_element('vc_googleplus'); vc_remove_element('vc_images_carousel'); vc_remove_element('vc_item'); vc_remove_element('vc_items'); vc_remove_element('vc_pinterest'); vc_remove_element('vc_posts_slider'); vc_remove_element('vc_toggle'); vc_remove_element('vc_tweetmeme'); vc_remove_element("vc_message");
function zen_theme_setup() { add_theme_support('woocommerce'); /************************************************************/ /* Load the textdomain, for later translations. */ /************************************************************/ load_theme_textdomain('zen7', get_template_directory() . '/lang'); /***********************************************************************************************/ /* Set the max width of the uploaded images */ /***********************************************************************************************/ if (!isset($content_width)) { $content_width = 1028; } /***********************************************************************************************/ /* Set the vc_path to the new folder */ /***********************************************************************************************/ if (function_exists('vc_set_template_dir')) { $dir = get_stylesheet_directory() . '/vc_templates/'; vc_set_template_dir($dir); } if (function_exists('vc_set_as_theme')) { vc_set_as_theme(true); } /***********************************************************************************************/ /* Add Theme Support for Post Formats, Post Thumbnails and Automatic Feed Links */ /***********************************************************************************************/ if (function_exists('add_theme_support')) { // This theme supports a variety of post formats. add_theme_support('post-formats', array('quote', 'gallery', 'video', 'audio')); add_theme_support('post-thumbnails'); set_post_thumbnail_size(125, 125, true); update_option('thumbnail_size_w', 350); update_option('thumbnail_size_h', 350); // Adds RSS feed links to <head> for posts and comments. add_theme_support('automatic-feed-links'); // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); } if (function_exists('add_image_size')) { add_image_size('custom_blog_image_1', 705, 350, true); add_image_size('custom_blog_image_2', 295, 9999); add_image_size('custom_masonry_image_1', 261, 9999); add_image_size('custom_masonry_image_2', 553, 9999); add_image_size('zen_gallery_images_1', 705, 276, true); add_image_size('zen_gallery_images_1_single', 730, 470, true); add_image_size('blog_single_1', 170, 170, true); add_image_size('parallax_header_bg', 1366, 247); add_image_size('portfolio_single_big', 1015, 532, true); add_image_size('portfolio_single_gallery', 255, 255, true); add_image_size('portfolio_blog_1', 350, 236, true); add_image_size('portfolio_blog_3', 758, 9999); add_image_size('blog_single_gallery', 400, 400, true); add_image_size('zen_testimonials', 74, 74, true); add_image_size('zen_team', 350, 297, true); } /************************************************************/ /* Load custom Scripts and Styles for Zen7. */ /************************************************************/ add_action('wp_enqueue_scripts', 'zen_load_custom_scripts'); add_action('wp_enqueue_scripts', 'zen_load_custom_styles'); /************************************************************/ /* Register the menus. */ /************************************************************/ add_action('init', 'zen_register_my_menus'); /************************************************************/ /* Filters for the comments forms. */ /************************************************************/ add_filter('comment_form_defaults', 'zen_custom_comment_form'); add_filter('comment_form_default_fields', 'zen_custom_comment_fields'); add_action('print_media_templates', 'zen_media_gallery'); add_filter('attachment_fields_to_edit', 'zen_attachment_fields_to_edit', 10, 2); add_action('edit_attachment', 'zen_save_attachment_fields'); add_filter('widget_text', 'do_shortcode'); add_action('wp_head', 'zen_google_analytics'); }
/** * Add the shortcode in the visual composer box. * * @param string $name The name of shortcode * @param array $args The array of arguments for the shortcode * * @return string * @since 1.0.0 * @author Antonino Scarfì <*****@*****.**> */ public function add_visual_composer_shortcode($name, $args = array(), $icon) { if (!defined('WPB_VC_VERSION') || !isset($args['in_visual_composer']) || !$args['in_visual_composer']) { return; } $vc_args = array("name" => $args['title'], "icon" => "yith_shortcodes", "class" => "yith_shortcodes", "description" => $args['description'], "base" => $name, "category" => __('Content'), "params" => array()); if (isset($icon) && !empty($icon) && $icon != '' && $icon) { $vc_args["icon"] = $icon; unset($vc_args["class"]); } $type_replacements = array('number' => 'textfield', 'code' => 'textarea_raw_html'); $allowed_types = array('textarea_html', 'textfield', 'textarea', 'dropdown', 'attach_image', 'attach_images', 'posttypes', 'colorpicker', 'exploded_textarea', 'widgetised_sidebars', 'textarea_raw_html', 'vc_link', 'checkbox'); //Adds custom type to allowed type $files = scandir($this->plugin_path . '/templates/admin/fields/'); //Removes ../ and ./ unset($files[0]); unset($files[1]); foreach ($files as $file) { $type = str_replace('.php', '', $file); $allowed_types[] = $type; } // fields foreach ($args['attributes'] as $field_id => $field) { if (isset($field['hide']) && $field['hide']) { //Hide field hidden for VC panel continue; } foreach ($type_replacements as $from => $to) { $field['type'] = preg_replace('/^' . $from . '$/', $to, $field['type']); } // type if (!in_array($field['type'], $allowed_types)) { continue; } // value $value = $field['std']; $std = $field['std']; if ($field['type'] == 'dropdown') { $value = array_flip($field['options']); } elseif ($field['type'] == 'checkbox') { $field['type'] = 'select'; $field['options'] = array_flip(array(__('Yes', 'yit') => '1', __('No', 'yit') => '0')); //$value = array( $field['title'] => ( $field['std'] == 'yes' ) ? 'true' : 'false' ); $std = $field['std'] == 'yes' ? '1' : '0'; } elseif ($field['type'] == 'select' && isset($field['multiple']) && $field['multiple']) { $std = maybe_unserialize($field['std']); $value = !is_array($std) ? $std : implode(',', $std); } elseif ($field['type'] == 'text') { $std = ''; } $field_args = array("type" => $field['type'], "holder" => isset($args['visual_composer_label']) && $args['visual_composer_label'] != "hidden" && $field_id == $args['visual_composer_label'] ? "div" : "hidden", "class" => "", "heading" => $field['title'], "param_name" => $field_id, "value" => $value, "std" => $std, "description" => isset($field['description']) ? $field['description'] : '', "yit_atts" => $field, "shortcode_id" => $name); if (!empty($field['deps'])) { $field_args['dependency'] = array('element' => $field['deps']['ids'], 'value' => is_array($field['deps']['values']) ? $field['deps']['values'] : array($field['deps']['values'])); } $vc_args['params'][] = $field_args; } // add content field //$value = empty( $args['attributes'] ) && isset( $args['code'] ) ? base64_encode( $args['code'] ) : ''; $value = isset($args['code']) ? $args['code'] : ''; $value = preg_replace(array('/^\\[' . $name . '\\]/', '^\\[\\/' . $name . '\\]$^'), '', $value); if (isset($args['has_content']) && $args['has_content']) { $vc_args['params'][] = array("type" => isset($args['code']) ? 'textarea' : 'textarea_html', "holder" => isset($args['visual_composer_label']) && $args['visual_composer_label'] != "hidden" && $args['visual_composer_label'] == 'content' ? "div" : "hidden", "class" => "", "heading" => __('Content', 'yit'), "param_name" => 'content', 'value' => $value, "description" => __('The content of shortcode', 'yit')); } // add in visual composer vc_map($vc_args); //update shortcode in visual composer Widgetised sidebar $yit_widget_sidebar = array("params" => array(array("type" => "textfield", "heading" => __("Widget title", "js_composer"), "param_name" => "title", "description" => __("Enter text which will be used as widget title. Leave blank if no title is needed.", "js_composer")), array("type" => "widgetised_sidebars", "heading" => __("Sidebar", "js_composer"), "param_name" => "sidebar_id", "description" => __("Select which widget area output.", "js_composer")), array("type" => "dropdown", "heading" => __("Layout", "js_composer"), "param_name" => "layout", "value" => array(__("Vertical", "yit") => "vertical", __("Horizontal", "yit") => "horizontal"), "description" => __("Select how display the sidebar", "yit")), array("type" => "dropdown", "heading" => __("Number of columns", "yit"), "param_name" => "num_of_col", "value" => array(1, 2, 3, 4), "description" => __("Select how many columns display", "yit"), "dependency" => array('element' => "layout", 'value' => 'horizontal')), array("type" => "textfield", "heading" => __("Extra class name", "js_composer"), "param_name" => "el_class", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", "js_composer")))); vc_map_update('vc_widget_sidebar', $yit_widget_sidebar); $dir = $this->plugin_path . '/templates/shortcodes/'; vc_set_template_dir($dir); }