and
tags if block */ remove_filter('the_content', 'wpautop'); add_filter('the_content', function ($content) { if ( has_blocks() ) { return $content; } return wpautop($content); }); /** * Enqueue Gutenberg block assets for backend editor. * * `wp-blocks`: includes block type registration and related functions. * `wp-element`: includes the WordPress Element abstraction for describing the structure of your blocks. * `wp-i18n`: To internationalize the block's text. * * @since 1.0.0 */ // Hook: Editor assets. add_action( 'enqueue_block_editor_assets', 'elegant_blocks_cgb_editor_assets' ); function elegant_blocks_cgb_editor_assets() { wp_enqueue_script( 'wp-api' ); // Scripts. wp_enqueue_script( 'jquery-ui-dialog' ); wp_enqueue_script( 'elegant-blocks-cgb-block-js', // Handle. plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack. array( 'wp-blocks', 'wp-i18n', 'wp-element' , 'wp-components' , 'wp-editor' ) // Dependencies, defined above. ); wp_enqueue_script( 'elegant_blocks_backend_editor_js', plugins_url( '/dist/js/editor.js', dirname( __FILE__ ) ), array( 'wp-blocks', 'wp-dom' ), time(), true ); // This js file will be included in both frontend and backend wp_enqueue_script( 'elegant_blocks_frontend_backend_js', plugins_url( '/dist/js/frontend_backend.js', dirname( __FILE__ ) ), array(), time(), true ); // Get google map api $google_map_api = get_option( 'elegant_blocks_google_map_api' ); $google_map_script = get_option( 'elegant_blocks_google_map_script' ); if( empty( $google_map_script ) ){ wp_enqueue_script( 'elegant_blocks_google_map', '//maps.googleapis.com/maps/api/js?libraries=places&key=' . esc_attr( $google_map_api ), '0.1', true ); } wp_enqueue_style( 'wp-jquery-ui-dialog' ); wp_enqueue_style( 'gutenberg-editor-css', plugins_url( '/dist/css/gutenberg-base-editor-style.css', dirname( __FILE__ ) ) ); wp_enqueue_style( 'gutenberg-blocks-css', plugins_url( '/dist/css/gutenberg-blocks.css', dirname( __FILE__ ) ) ); wp_enqueue_style( 'font-awesome-5-backend', plugins_url( '/dist/font-awesome-5/css/all.css', dirname( __FILE__ ) ) ); } add_action( 'wp_enqueue_scripts', 'elegant_blocks_main_style' , 999 ); function elegant_blocks_main_style(){ wp_enqueue_style( 'elegant_blocks_custom_css', plugins_url( '/dist/css/elegantblock_style.css', dirname( __FILE__ ) ) ); wp_enqueue_style( 'gutenberg-blocks-css', plugins_url( '/dist/css/gutenberg-blocks.css', dirname( __FILE__ ) ) ); } add_action( 'wp_enqueue_scripts', 'elegant_blocks_plugin_styles' ); function elegant_blocks_plugin_styles() { $bootstrap_status = absint( get_option( 'elegant_blocks_bootstrap_status' ) ); $google_font_status = absint( get_option( 'elegant_blocks_google_font_status' ) ); $bootstrap_status = apply_filters( 'elegant_blocks_bootstrap', false ); if( empty( $bootstrap_status ) ){ wp_enqueue_style( 'bootstrap', plugins_url( '/dist/css/bootstrap.min.css', dirname( __FILE__ ) ) ); wp_enqueue_script( 'bootstrap.js', plugins_url( '/dist/js/bootstrap.min.js', dirname( __FILE__ ) ) , array(), '0.1', true ); } $fontawesome_status = apply_filters( 'elegant_blocks_fontawesome', false ); if( empty( $fontawesome_status ) ){ wp_enqueue_style( 'font-awesome-5', plugins_url( '/dist/font-awesome-5/css/all.css', dirname( __FILE__ ) ) ); } wp_enqueue_style( 'animate', plugins_url( '/dist/css/animate.min.css', dirname( __FILE__ ) ) ); wp_enqueue_style( 'elegant_blocks_plugins_css', plugins_url( '/dist/css/plugins.css', dirname( __FILE__ ) ) ); // Add Google Font if( empty( $google_font_status ) ){ wp_enqueue_style( 'open_sans_google_font', 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800' ); wp_enqueue_style( 'poppins_google_font', 'https://fonts.googleapis.com/css?family=Poppins:300,400,600,700,800' ); wp_enqueue_style( 'roboto_google_font', 'https://fonts.googleapis.com/css?family=Roboto:300,400,600,700,800' ); } // JS wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery.touchSwipe.for.forms.min.js', plugins_url( '/dist/js/jquery.touchSwipe.for.forms.min.js', dirname( __FILE__ ) ) , array(), '0.1', true ); wp_enqueue_script( 'elegant_blocks_responsive_bootstrap_carousel.min.js', plugins_url( '/dist/js/responsive_bootstrap_carousel.min.js', dirname( __FILE__ ) ) , array(), '0.1', true ); wp_enqueue_script( 'slider_min.min.js', plugins_url( '/dist/js/slider_min.js', dirname( __FILE__ ) ) , array(), '0.1', true ); wp_enqueue_script( 'elegantblock_custom', plugins_url( '/dist/js/elegantblock_custom.js', dirname( __FILE__ ) ) , array(), '0.1', false ); wp_enqueue_script( 'elegant_blocks_plugins_js', plugins_url( '/dist/js/plugins.js', dirname( __FILE__ ) ) , array(), '0.1', true ); wp_enqueue_script( 'instagram_js', plugins_url( '/dist/js/instagram.js', dirname( __FILE__ ) ) , array(), '0.1', false ); wp_enqueue_script( 'slick', plugins_url( '/dist/js/slick.js', dirname( __FILE__ ) ) , array(), '0.1', true ); // This js file will be included in both frontend and backend wp_register_script( 'elegant_blocks_frontend_backend_js', plugins_url( '/dist/js/frontend_backend.js', dirname( __FILE__ ) ), array(), time(), true ); $translation_array = array( 'ELEGANTBLOCKS_PLUGIN_URL' => ELEGANTBLOCKS_PLUGIN_URL ); wp_localize_script( 'elegant_blocks_frontend_backend_js', 'mb_backend_object', $translation_array ); wp_enqueue_script( 'elegant_blocks_frontend_backend_js' ); // Get google map api $google_map_api = get_option( 'elegant_blocks_google_map_api' ); $google_map_script = get_option( 'elegant_blocks_google_map_script' ); if( empty( $google_map_script ) ){ wp_enqueue_script( 'elegant_blocks_google_map', '//maps.googleapis.com/maps/api/js?libraries=places&key=' . esc_attr( $google_map_api ), '0.1', true ); } } // admin css and js add_action( 'admin_enqueue_scripts', 'elegant_blocks_backend_css_js' , 999 ); function elegant_blocks_backend_css_js() { wp_enqueue_style( 'elegant_blocks_backend_css', plugins_url( '/dist/css/admin.css', dirname( __FILE__ ) ), false, '0.1' ); // Localize the script with new data $disable_blocks = get_option( 'elegant_blocks_block_status' ); $translation_array = array( 'animate_style_options' => elegant_blocks_animate_css_options(), 'progress_bar_limit' => apply_filters( 'elegant_blocks_progress_bar_limit', 10 ), 'disable_blocks' => empty( $disable_blocks ) ? array() : $disable_blocks, 'shape_images' => elegant_blocks_shapes(), 'shape_svg' => elegant_blocks_shapes_svg(), 'markers' => elegant_blocks_map_icons(), 'google_map_api' => get_option( 'elegant_blocks_google_map_api' ), 'elegant_blocks_settings_page' => admin_url( 'admin.php?page=elegant-blocks-settings' ), 'ELEGANTBLOCKS_PLUGIN_URL' => ELEGANTBLOCKS_PLUGIN_URL, 'fontawesome_icons' => bizberg_fontawesome_5_icons(), 'google_fonts' => json_decode( GOOGLE_FONTS , true ), 'pro_status' => get_option( 'pro_status' ), 'demo_import_page' => admin_url( '/themes.php?page=cyclone-one-click-demo-import' ) ); wp_register_script( 'elegant_blocks_backend_js', plugins_url( '/dist/js/admin.js', dirname( __FILE__ ) ) , array(), time(), true ); wp_localize_script( 'elegant_blocks_backend_js', 'mb_backend_object', $translation_array ); wp_enqueue_script( 'elegant_blocks_backend_js' ); } add_image_size( 'elegant_blocks_team_1', 500, 500, true ); add_image_size( 'elegant_blocks_blog_1', 693, 462, true ); add_image_size( 'elegant_blocks_slider_1', 1600, 1000, true ); /** * Register new categories */ add_filter( 'block_categories', 'elegant_blocks_categories', 10, 2 ); function elegant_blocks_categories( $categories, $post ) { $cat = array_merge( $categories, array( array( 'slug' => 'elegant-blocks-newsletters-template', 'title' => __( 'EB Newsletters Template', 'elegant-blocks' ) ), array( 'slug' => 'elegant-blocks-video-template', 'title' => __( 'EB Videos Template', 'elegant-blocks' ) ), array( 'slug' => 'elegant-blocks-description-template', 'title' => __( 'EB Descriptions Template', 'elegant-blocks' ) ), array( 'slug' => 'elegant-blocks-banner-template', 'title' => __( 'EB Banners Template', 'elegant-blocks' ) ), array( 'slug' => 'elegant-blocks', 'title' => __( 'Elegant Blocks', 'elegant-blocks' ) ), ) ); return array_reverse( $cat ); } // Animate.css animations styles function elegant_blocks_animate_css_options(){ $styles = array( 'bounce' => 'bounce', 'flash' => 'flash', 'pulse' => 'pulse', 'rubberBand' => 'rubberBand', 'shake' => 'shake', 'swing' => 'swing', 'tada' => 'tada', 'wobble' => 'wobble', 'jello' => 'jello', 'bounceIn' => 'bounceIn', 'bounceInDown' => 'bounceInDown', 'bounceInUp' => 'bounceInUp', 'fadeIn' => 'fadeIn', 'fadeInDown' => 'fadeInDown', 'fadeInDownBig' => 'fadeInDownBig', 'fadeInLeft' => 'fadeInLeft', 'fadeInLeftBig' => 'fadeInLeftBig', 'fadeInRight' => 'fadeInRight', 'fadeInRightBig' => 'fadeInRightBig', 'fadeInUp' => 'fadeInUp', 'fadeInUpBig' => 'fadeInUpBig', 'flip' => 'flip', 'flipInX' => 'flipInX', 'flipInY' => 'flipInY', 'lightSpeedIn' => 'lightSpeedIn', 'rotateIn' => 'rotateIn', 'rotateInDownLeft' => 'rotateInDownLeft', 'rotateInDownRight' => 'rotateInDownRight', 'rotateInUpLeft' => 'rotateInUpLeft', 'rotateInUpRight' => 'rotateInUpRight', 'slideInUp' => 'slideInUp', 'slideInDown' => 'slideInDown', 'slideInLeft' => 'slideInLeft', 'slideInRight' => 'slideInRight', 'zoomIn' => 'zoomIn', 'zoomInDown' => 'zoomInDown', 'zoomInLeft' => 'zoomInLeft', 'zoomInRight' => 'zoomInRight', 'zoomInUp' => 'zoomInUp', 'hinge' => 'hinge', 'rollIn' => 'rollIn', ); $options = array(); foreach ( $styles as $key => $value ) { $options[] = array( 'label' => $key, 'value' => $value ); } return $options; } function elegant_blocks_color_luminance( $hex, $diff ) { $rgb = str_split(trim($hex, '# '), 2); foreach ($rgb as &$hex) { $dec = hexdec($hex); if ($diff >= 0) { $dec += $diff; } else { $dec -= abs($diff); } $dec = max(0, min(255, $dec)); $hex = str_pad(dechex($dec), 2, '0', STR_PAD_LEFT); } return '#'.implode($rgb); } add_action( 'plugins_loaded', 'elegant_blocks_register_dynamic_block', 10 ); function elegant_blocks_register_dynamic_block() { // Only load if Gutenberg is available. if ( !function_exists( 'register_block_type' ) ) { return; } // Hook server side rendering into render callback register_block_type( 'elegant-blocks-plugin/team', array( 'render_callback' => 'elegant_blocks_render_dynamic_block_team_1', ) ); register_block_type( 'elegant-blocks-plugin/blog-1', array( 'render_callback' => 'elegant_blocks_render_blog_1', ) ); register_block_type( 'elegant-blocks-plugin/slider', array( 'render_callback' => 'elegant_blocks_render_slider_1', ) ); register_block_type( 'elegant-blocks-plugin/testimonials', array( 'render_callback' => 'elegant_blocks_render_testimonial_1', ) ); register_block_type( 'elegant-blocks-plugin/gallery', array( 'render_callback' => 'elegant_blocks_render_gallery_1', ) ); register_block_type( 'elegant-blocks-plugin/calltoaction', array( 'render_callback' => 'elegant_blocks_render_calltoaction_1', ) ); register_block_type( 'elegant-blocks-plugin/instagram', array( 'render_callback' => 'elegant_blocks_render_instagram_1', ) ); register_block_type( 'ct-plugin/instagram-1', array( 'render_callback' => 'elegant_blocks_render_instagram_1', ) ); register_block_type( 'elegant-blocks-plugin/services', array( 'render_callback' => 'elegant_blocks_render_services_1', ) ); register_block_type( 'elegant-blocks-plugin/tabs', array( 'render_callback' => 'elegant_blocks_render_tabs', ) ); register_block_type( 'elegant-blocks-plugin/accordion', array( 'render_callback' => 'elegant_blocks_render_accordion', ) ); register_block_type( 'elegant-blocks-plugin/social-icons', array( 'render_callback' => 'elegant_blocks_render_social_icons', ) ); register_block_type( 'elegant-blocks-plugin/pricing-table', array( 'render_callback' => 'elegant_blocks_render_pricing_table', ) ); register_block_type( 'elegant-blocks-plugin/progress-bar', array( 'render_callback' => 'elegant_blocks_render_progress_bar', ) ); register_block_type( 'elegant-blocks-plugin/heading', array( 'render_callback' => 'elegant_blocks_render_heading', ) ); register_block_type( 'elegant-blocks-plugin/countup', array( 'render_callback' => 'elegant_blocks_render_countup', ) ); register_block_type( 'elegant-blocks-plugin/shape-divider', array( 'render_callback' => 'elegant_blocks_render_shape_divider', ) ); register_block_type( 'elegant-blocks-plugin/map', array( 'render_callback' => 'elegant_blocks_render_map', ) ); register_block_type( 'elegant-blocks-plugin/clients', array( 'render_callback' => 'elegant_blocks_render_clients', ) ); register_block_type( 'elegant-blocks-plugin/description-1', array( 'render_callback' => 'elegant_blocks_render_description_1', ) ); register_block_type( 'elegant-blocks-plugin/banner-1', array( 'render_callback' => 'elegant_blocks_render_banner_1', ) ); register_block_type( 'elegant-blocks-plugin/eb-container', array( 'render_callback' => 'elegant_blocks_render_container', ) ); register_block_type( 'elegant-blocks-plugin/video-1', array( 'render_callback' => 'elegant_blocks_render_video_1', ) ); register_block_type( 'elegant-blocks-plugin/text', array( 'render_callback' => 'elegant_blocks_render_text', ) ); register_block_type( 'elegant-blocks-plugin/newsletter-1', array( 'render_callback' => 'elegant_blocks_render_newsletter_1', ) ); } /** * Check if gutenberg is install or not */ add_action( 'admin_notices', 'elegant_blocks_check_gutenberg' ); function elegant_blocks_check_gutenberg(){ if( !function_exists( 'register_block_type' ) ){ ?>
Elegant Blocks is a plugin made for CycloneTheme's themes. Hide this Message
To import demo data, you will need the following plugin(s) first.
Install & Activate