Lumberjack\Functions\Assets::load PHP Method

load() public static method

En-queue required assets
public static load ( string $filter = 'wp_enqueue_scripts', integer $priority = 10 )
$filter string The name of the filter to hook into
$priority integer The priority to attach the filter with
    public static function load($filter = 'wp_enqueue_scripts', $priority = 10)
    {
        // Register the filter
        add_filter($filter, function ($paths) {
            wp_deregister_script('jquery');
            // Load CDN jQuery in the footer
            wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js', false, '1.11.3', true);
            wp_enqueue_script('jquery');
        });
    }

Usage Example

Exemplo n.º 1
0
use Lumberjack\Config\Menus;
use Lumberjack\Functions\Assets;
require_once 'autoload.php';
/**
 * ------------------
 * Core
 * ------------------
 */
// Set up the default Timber context & extend Twig for the site
new Site();
/**
 * ------------------
 * Config
 * ------------------
 */
// Register support of certain theme features
ThemeSupport::register();
// Register any custom post types
CustomPostTypes::register();
// Register any custom taxonomies
CustomTaxonomies::register();
// Register WordPress menus
Menus::register();
/**
 * ------------------
 * Functions
 * ------------------
 */
// Enqueue assets
Assets::load();
Assets