| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * Title: Elements Initializer |
|---|
| 4 | * |
|---|
| 5 | * Description: Initializes the elements. Adds all required files. |
|---|
| 6 | * |
|---|
| 7 | * Please do not edit this file. This file is part of the Cyber Chimps Framework and all modifications |
|---|
| 8 | * should be made in a child theme. |
|---|
| 9 | * |
|---|
| 10 | * @category Cyber Chimps Framework |
|---|
| 11 | * @package Framework |
|---|
| 12 | * @since 1.0 |
|---|
| 13 | * @author CyberChimps |
|---|
| 14 | * @license http://www.opensource.org/licenses/gpl-license.php GPL v3.0 (or later) |
|---|
| 15 | * @link http://www.cyberchimps.com/ |
|---|
| 16 | */ |
|---|
| 17 | |
|---|
| 18 | /** |
|---|
| 19 | * Add plugin automation file |
|---|
| 20 | */ |
|---|
| 21 | require_once( dirname( __FILE__ ) . '/inc/class-tgm-plugin-activation.php' ); |
|---|
| 22 | |
|---|
| 23 | // Load style for elements |
|---|
| 24 | function cyberchimps_add_elements_style() { |
|---|
| 25 | |
|---|
| 26 | // Set directory uri |
|---|
| 27 | $directory_uri = get_template_directory_uri(); |
|---|
| 28 | |
|---|
| 29 | wp_enqueue_style( 'elements_style', $directory_uri . '/elements/lib/css/elements.css' ); |
|---|
| 30 | |
|---|
| 31 | wp_enqueue_script( 'elements_js', $directory_uri . '/elements/lib/js/elements.min.js' ); |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | add_action( 'wp_enqueue_scripts', 'cyberchimps_add_elements_style', 30 ); |
|---|
| 35 | |
|---|
| 36 | // Load elements |
|---|
| 37 | // Set directory path |
|---|
| 38 | $directory_path = get_template_directory(); |
|---|
| 39 | |
|---|
| 40 | require_once( $directory_path . '/elements/parallax.php' ); |
|---|
| 41 | require_once( $directory_path . '/elements/portfolio-lite.php' ); |
|---|
| 42 | require_once( $directory_path . '/elements/slider-lite.php' ); |
|---|
| 43 | require_once( $directory_path . '/elements/boxes.php' ); |
|---|
| 44 | require_once( $directory_path . '/elements/testimonial.php' ); |
|---|
| 45 | require_once( $directory_path . '/elements/contact-us.php' ); |
|---|
| 46 | |
|---|
| 47 | // main blog drag and drop options |
|---|
| 48 | function cyberchimps_selected_elements() { |
|---|
| 49 | $options = array( |
|---|
| 50 | 'boxes_lite' => __( 'Boxes Lite', 'cyberchimps_core' ), |
|---|
| 51 | "portfolio_lite" => __( 'Portfolio Lite', 'cyberchimps_core' ), |
|---|
| 52 | "blog_post_page" => __( 'Post Page', 'cyberchimps_core' ), |
|---|
| 53 | "slider_lite" => __( 'Slider Lite', 'cyberchimps_core' ), |
|---|
| 54 | "testimonial" => __( 'Testimonial', 'cyberchimps_core'), |
|---|
| 55 | "map_contact" => __( 'Contact Us', 'cyberchimps_core') |
|---|
| 56 | ); |
|---|
| 57 | |
|---|
| 58 | return $options; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | add_filter( 'cyberchimps_elements_draganddrop_options', 'cyberchimps_selected_elements' ); |
|---|
| 62 | |
|---|
| 63 | function cyberchimps_selected_page_elements() { |
|---|
| 64 | $options = array( |
|---|
| 65 | 'boxes_lite' => __( 'Boxes Lite', 'cyberchimps_core' ), |
|---|
| 66 | "portfolio_lite" => __( 'Portfolio Lite', 'cyberchimps_core' ), |
|---|
| 67 | "page_section" => __( 'Page', 'cyberchimps_core' ), |
|---|
| 68 | "slider_lite" => __( 'Slider Lite', 'cyberchimps_core' ), |
|---|
| 69 | "testimonial" => __( 'Testimonial', 'cyberchimps_core'), |
|---|
| 70 | "map_contact" => __( 'Contact Us', 'cyberchimps_core') |
|---|
| 71 | ); |
|---|
| 72 | |
|---|
| 73 | return $options; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | add_filter( 'cyberchimps_elements_draganddrop_page_options', 'cyberchimps_selected_page_elements' ); |
|---|
| 77 | |
|---|
| 78 | // drop breadcrumb fields |
|---|
| 79 | function cyberchimps_element_drop_fields( $fields ) { |
|---|
| 80 | // drop unwanted fields |
|---|
| 81 | foreach( $fields as $key => $value ) { |
|---|
| 82 | if( $value['id'] == 'single_post_breadcrumbs' || $value['id'] == 'archive_breadcrumbs' ) { |
|---|
| 83 | unset( $fields[$key] ); |
|---|
| 84 | } |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | return $fields; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | add_filter( 'cyberchimps_field_filter', 'cyberchimps_element_drop_fields', 2 ); |
|---|