addCustomFilter('foo', ['FooHandler', 'handleFoo']) is * equivalent to add_filter('slug-foo', ['FooHandler', 'handleFoo']). */ /** * * @var Application $app */ add_filter('block_categories_all', function ($categories) { $categories[] = array( 'slug' => 'fluent-cart', 'title' => __('FluentCart', 'fluent-cart'), ); $categories[] = array( 'slug' => 'fluent-cart-buttons', 'title' => __('FluentCart Buttons', 'fluent-cart'), ); return $categories; }); add_filter('fluent_cart/dummy_product_info', function ($info) { $infos = [ 'mens-shoes' => [ 'title' => __("Men’s Shoes", 'fluent-cart'), 'count' => "0", 'category' => 'mens-shoes', 'icon' => 'RunningShoe' ], 'menswear' => [ 'title' => __("Menswear", 'fluent-cart'), 'count' => "0", 'category' => 'menswear', 'icon' => 'Cloth' ], // 'clothing' => [ // 'title' => __("Clothing's", 'fluent-cart'), // 'count' => "0", // 'category' => 'clothing' // ], // 'food' => [ // 'title' => __("Food", 'fluent-cart'), // 'count' => "0", // 'category' => 'food' // ], // 'electronics' => [ // 'title' => __('Electronics', 'fluent-cart'), // 'count' => "0", // 'category' => 'electronics' // ] ]; foreach ($infos as $key => $info) { $filePath = FLUENTCART_PLUGIN_PATH . 'dummies' . DIRECTORY_SEPARATOR . $key . '.json'; if (file_exists($filePath)) { try { $json = file_get_contents($filePath); $products = json_decode($json, true); $infos[$key]['count'] = count($products); } catch (\Exception $exception) { } } } return $infos; });