| @@ -7,22 +7,34 @@ | ||
| 7 | 7 | function blockspare_blocks_block_assets() |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | 10 | $min = (SCRIPT_DEBUG == true) ? '' : '.min'; |
| 11 | + | |
| 12 | + // Load the compiled styles. | |
| 11 | 13 | wp_enqueue_style( |
| 14 | + 'blockspare-frontend-block-style-css', | |
| 15 | + plugins_url('dist/blocks.style.build.css', dirname(__FILE__)), | |
| 16 | + array() | |
| 17 | + ); | |
| 18 | + | |
| 19 | + } | |
| 20 | + | |
| 21 | + add_action('init', 'blockspare_blocks_block_assets'); | |
| 22 | + | |
| 23 | + | |
| 24 | + add_action('wp_enqueue_scripts', 'blockspare_load_scripts'); | |
| 25 | + | |
| 26 | + function blockspare_load_scripts(){ | |
| 27 | + | |
| 28 | + $min = (SCRIPT_DEBUG == true) ? '' : '.min'; | |
| 29 | + | |
| 30 | + wp_enqueue_style( | |
| 12 | 31 | 'blockspare-blocks-fontawesome-front', |
| 13 | 32 | plugins_url('src/assets/fontawesome/css/all.css', dirname(__FILE__)), |
| 14 | 33 | array(), |
| 15 | 34 | filemtime(plugin_dir_path(__FILE__) . 'assets/fontawesome/css/all.css') |
| 16 | 35 | ); |
| 17 | - // Load the compiled styles. | |
| 18 | - wp_enqueue_style( | |
| 19 | - 'blockspare-frontend-block-style-css', | |
| 20 | - plugins_url('dist/blocks.style.build.css', dirname(__FILE__)), | |
| 21 | - array() | |
| 22 | - ); | |
| 23 | - | |
| 24 | - | |
| 36 | + | |
| 25 | 37 | wp_enqueue_style('slick', BLOCKSPARE_PLUGIN_URL . 'src/assets/slick/css/slick.css', array(), '', 'all'); |
| 26 | 38 | wp_enqueue_script('slick-js', BLOCKSPARE_PLUGIN_URL . 'src/assets/slick/js/slick.js', array('jquery'), '', true); |
| 27 | 39 | wp_register_script('countup', BLOCKSPARE_PLUGIN_URL . 'src/assets/js/countup/jquery.counterup' . $min . '.js', array('waypoint'), true); |
| 28 | 40 | |
| @@ -30,12 +42,12 @@ | ||
| 30 | 42 | wp_enqueue_script('jquery-masonry'); |
| 31 | 43 | |
| 32 | 44 | wp_enqueue_script('blockspare-script', BLOCKSPARE_PLUGIN_URL . 'src/assets/js/frontend.js', array('jquery', 'waypoint', 'countup'), '', true); |
| 33 | 45 | |
| 46 | + wp_enqueue_script('blockspare-tabs', BLOCKSPARE_PLUGIN_URL . 'src/assets/js/tabs.js', array('jquery'), '', true); | |
| 47 | + | |
| 34 | 48 | } |
| 35 | 49 | |
| 36 | - add_action('init', 'blockspare_blocks_block_assets'); | |
| 37 | - | |
| 38 | 50 | if (!function_exists('blockspare_create_block')) { |
| 39 | 51 | |
| 40 | 52 | |
| 41 | 53 | function blockspare_create_block() |
| @@ -70,8 +82,20 @@ | ||
| 70 | 82 | $blockspare_priview_img_url = BLOCKSPARE_PLUGIN_URL . 'dist/images/blockspare-placeholder-img.jpg'; |
| 71 | 83 | $blockspare_food_img_url = BLOCKSPARE_PLUGIN_URL . 'src/assets/blockspare-placeholder-img-square.jpg'; |
| 72 | 84 | |
| 73 | 85 | |
| 86 | + $taxonomies = get_categories(); | |
| 87 | + $txnm = array(); | |
| 88 | + | |
| 89 | + foreach( $taxonomies as $type ) { | |
| 90 | + | |
| 91 | + | |
| 92 | + $txnm[] = array( | |
| 93 | + 'label' => $type->name, | |
| 94 | + 'value' => $type->term_id, | |
| 95 | + ); | |
| 96 | + } | |
| 97 | + | |
| 74 | 98 | wp_localize_script( |
| 75 | 99 | 'blockspare-blocks-block-js', |
| 76 | 100 | 'blockspare_globals', |
| 77 | 101 | array( |
| @@ -77,9 +101,13 @@ | ||
| 77 | 101 | array( |
| 78 | 102 | 'srcUrl' => untrailingslashit(plugins_url('/', BLOCKSPARE_BASE_DIR . '/dist/')), |
| 79 | 103 | 'rest_url' => esc_url(rest_url()), |
| 80 | 104 | 'img' => $blockspare_priview_img_url, |
| 81 | - 'menu_img_url' => $blockspare_food_img_url | |
| 105 | + 'menu_img_url' => $blockspare_food_img_url, | |
| 106 | + 'taxonomies'=> json_encode($txnm), | |
| 107 | + 'config' => '', | |
| 108 | + 'configuration' => '', | |
| 109 | + 'settings' => '', | |
| 82 | 110 | ) |
| 83 | 111 | ); |
| 84 | 112 | } |
| 85 | 113 | |
| @@ -96,8 +124,9 @@ | ||
| 96 | 124 | //Load Gutenberg Block php Files |
| 97 | 125 | include(BLOCKSPARE_PLUGIN_DIR . '/src/blocks/social-sharing/index.php'); |
| 98 | 126 | include(BLOCKSPARE_PLUGIN_DIR . '/src/blocks/latest-posts-grid/index.php'); |
| 99 | 127 | include(BLOCKSPARE_PLUGIN_DIR . '/src/blocks/latest-posts-list/index.php'); |
| 128 | + //include(BLOCKSPARE_PLUGIN_DIR . '/src/blocks/pattern/pattern.php'); | |
| 100 | 129 | |
| 101 | 130 | |
| 102 | 131 | } |
| 103 | 132 | |
| @@ -109,7 +138,10 @@ | ||
| 109 | 138 | function blockspare_enqueue_admin_style() |
| 110 | 139 | { |
| 111 | 140 | wp_enqueue_style('slick', BLOCKSPARE_PLUGIN_URL . 'src/assets/slick/css/slick.css', array(), '', 'all'); |
| 112 | 141 | } |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 113 | 145 | |
| 114 | 146 | |
| 115 | 147 | |