framework_path, $src); $src = sprintf('%sassets/%s', json_decode( BINGOPRESS_PATH )->framework_url, $src); if(!file_exists($file)) return; } wp_enqueue_style( $handle, $src, $deps, $ver, $media ); } /** * WordPress enqueue script * * @var string $handle Name of the script. Should be unique * @var string $src Full URL of the script, or path of the script relative to the WordPress root directory * @var array $deps An array of registered script handles this script depends on * @var string $ver String specifying script version number, if it has one, which is added to the URL as a query string for cache busting purposes * @var bool $in_footer Whether to enqueue the script before
instead of in the
*/ public function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) { if ( ! strpos( $src, '//' ) ) { $file = sprintf('%sassets/%s', json_decode( BINGOPRESS_PATH )->framework_path, $src); $src = sprintf('%sassets/%s', json_decode( BINGOPRESS_PATH )->framework_url, $src); if(!file_exists($file)) return; } wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); } /** * Enqueue assets at frontend */ public function enqueue_assets( $assets ) { foreach ( $assets as $asset_id => $asset ) { $asset = (object) $asset; if ( $asset->type == 'css' && $asset->status ) { $this->wp_enqueue_style( $asset_id, $asset->src ); } elseif ( $asset->type == 'js' && $asset->status ) { $this->wp_enqueue_script( $asset_id, $asset->src, array(), '', isset( $asset->in_footer ) ? true : false ); } } } }