Alters priority of some scripts enqueueing #473
This commit is contained in:
parent
1ba4ea31fd
commit
509cb6170a
|
@ -35,7 +35,7 @@ class Theme_Helper {
|
||||||
// Redirect to post type archive if no cover page is set
|
// Redirect to post type archive if no cover page is set
|
||||||
add_action('wp', array($this, 'collection_single_redirect'));
|
add_action('wp', array($this, 'collection_single_redirect'));
|
||||||
|
|
||||||
add_action('wp_print_scripts', array($this, 'enqueue_scripts'));
|
add_action('wp_print_scripts', array($this, 'enqueue_scripts'), 90);
|
||||||
|
|
||||||
// make archive for terms work with items
|
// make archive for terms work with items
|
||||||
add_action('pre_get_posts', array($this, 'tax_archive_pre_get_posts'));
|
add_action('pre_get_posts', array($this, 'tax_archive_pre_get_posts'));
|
||||||
|
@ -62,11 +62,7 @@ class Theme_Helper {
|
||||||
|
|
||||||
$this->register_view_mode('table', [
|
$this->register_view_mode('table', [
|
||||||
'label' => __('Table', 'tainacan'),
|
'label' => __('Table', 'tainacan'),
|
||||||
'dynamic_metadata' => true,
|
'dynamic_metadata' => true
|
||||||
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewtable tainacan-icon-1-25em"></i></span>',
|
|
||||||
'type' => 'component',
|
|
||||||
'implements_skeleton' => true,
|
|
||||||
'requires_thumbnail' => false
|
|
||||||
]);
|
]);
|
||||||
$this->register_view_mode('cards', [
|
$this->register_view_mode('cards', [
|
||||||
'label' => __('Cards', 'tainacan'),
|
'label' => __('Cards', 'tainacan'),
|
||||||
|
@ -120,6 +116,8 @@ class Theme_Helper {
|
||||||
wp_register_script('tainacan-search', $TAINACAN_BASE_URL . '/assets/js/theme_search.js' , ['underscore'] , TAINACAN_VERSION);
|
wp_register_script('tainacan-search', $TAINACAN_BASE_URL . '/assets/js/theme_search.js' , ['underscore'] , TAINACAN_VERSION);
|
||||||
wp_localize_script('tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params());
|
wp_localize_script('tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_log('enqueue_scripts');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_post_an_item(\WP_Post $post) {
|
public function is_post_an_item(\WP_Post $post) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ class Component_Hooks {
|
||||||
// the priority should see less than on function
|
// the priority should see less than on function
|
||||||
// `load_admin_page()` of class `Admin` in file /src/views/class-tainacan-admin.php
|
// `load_admin_page()` of class `Admin` in file /src/views/class-tainacan-admin.php
|
||||||
add_action( 'wp_enqueue_scripts', array( &$this, 'register_component' ), 80 );
|
add_action( 'wp_enqueue_scripts', array( &$this, 'register_component' ), 80 );
|
||||||
|
add_action( 'admin_enqueue_scripts', array( &$this, 'register_component' ), 80 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register_component() {
|
public function register_component() {
|
||||||
|
|
|
@ -28,7 +28,8 @@ function tainacan_blocks_add_gutenberg_blocks_actions() {
|
||||||
add_action('init', 'tainacan_blocks_register_tainacan_facets_list');
|
add_action('init', 'tainacan_blocks_register_tainacan_facets_list');
|
||||||
add_action('init', 'tainacan_blocks_register_tainacan_item_submission_form');
|
add_action('init', 'tainacan_blocks_register_tainacan_item_submission_form');
|
||||||
|
|
||||||
add_action('init', 'tainacan_blocks_add_plugin_settings');
|
add_action('init', 'tainacan_blocks_add_plugin_settings', 90);
|
||||||
|
add_action('wp_enqueue_scripts', 'tainacan_blocks_add_plugin_admin_settings', 90);
|
||||||
|
|
||||||
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
|
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
|
||||||
add_action('init', 'tainacan_blocks_register_category_icon');
|
add_action('init', 'tainacan_blocks_register_category_icon');
|
||||||
|
@ -403,14 +404,13 @@ function tainacan_blocks_get_plugin_js_settings(){
|
||||||
'base_url' => $TAINACAN_BASE_URL,
|
'base_url' => $TAINACAN_BASE_URL,
|
||||||
'admin_url' => admin_url(),
|
'admin_url' => admin_url(),
|
||||||
'site_url' => site_url(),
|
'site_url' => site_url(),
|
||||||
'theme_items_list_url' => esc_url_raw( get_site_url() ) . '/' . \Tainacan\Theme_Helper::get_instance()->get_items_list_slug(),
|
'theme_items_list_url' => esc_url_raw( get_site_url() ) . '/' . \Tainacan\Theme_Helper::get_instance()->get_items_list_slug()
|
||||||
];
|
];
|
||||||
|
|
||||||
return $settings;
|
return $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
function tainacan_blocks_add_plugin_settings() {
|
function tainacan_blocks_add_plugin_settings() {
|
||||||
|
|
||||||
$settings = tainacan_blocks_get_plugin_js_settings();
|
$settings = tainacan_blocks_get_plugin_js_settings();
|
||||||
|
|
||||||
wp_localize_script( 'terms-list', 'tainacan_blocks', $settings );
|
wp_localize_script( 'terms-list', 'tainacan_blocks', $settings );
|
||||||
|
@ -423,6 +423,9 @@ function tainacan_blocks_add_plugin_settings() {
|
||||||
wp_localize_script( 'collections-list', 'tainacan_blocks', $settings );
|
wp_localize_script( 'collections-list', 'tainacan_blocks', $settings );
|
||||||
wp_localize_script( 'carousel-collections-list', 'tainacan_blocks', $settings );
|
wp_localize_script( 'carousel-collections-list', 'tainacan_blocks', $settings );
|
||||||
wp_localize_script( 'facets-list', 'tainacan_blocks', $settings );
|
wp_localize_script( 'facets-list', 'tainacan_blocks', $settings );
|
||||||
|
}
|
||||||
|
|
||||||
|
function tainacan_blocks_add_plugin_admin_settings() {
|
||||||
|
|
||||||
// The faceded search block uses a different settings object, the same used on the theme items list
|
// The faceded search block uses a different settings object, the same used on the theme items list
|
||||||
wp_localize_script( 'tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params() );
|
wp_localize_script( 'tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params() );
|
||||||
|
|
Loading…
Reference in New Issue