How to laod wp_enqueue_style to another header i created my self
name of the header manga-single-reading.php wp_enqueue_style code in wp-manga.php
the code is wp_enqueue_style( 'wp-manga-plugin-css', WP_MANGA_URI . 'assets/css/style.css' );
How to laod wp_enqueue_style to another header i created my self
name of the header manga-single-reading.php wp_enqueue_style code in wp-manga.php
the code is wp_enqueue_style( 'wp-manga-plugin-css', WP_MANGA_URI . 'assets/css/style.css' );
Share Improve this question asked Aug 6, 2020 at 7:24 التقنية techالتقنية tech 133 bronze badges1 Answer
Reset to default 0Wordpress features a very robust template hierarchy that should be observed, take a look at wphierarchy.
If you needed two header formats for some reason, you could create a file in the theme root called header-manga.php
which you could then call in your page template with <?php get_header( 'manga' ); ?>
.
Once you have your new header set-up you could create a custom page template like page-mymanga.php
which calls the manga header as above.
Once you have this, you can then set the page(s) you want to use this header to have the page template of page-mymanga.php
using the WP control panel, and then use a function in your themes functions.php
file that might look like this:
add_action('wp_enqueue_scripts','load_custom_template_script');
function load_custom_template_script(){
if ( is_page_template('page-mymanga.php') ) {
wp_enqueue_style( 'wp-manga-plugin-css', get_template_directory_uri() . '/assets/css/style.css' );
}
}
If you're working in a theme from the marketplace I would strongly recommend looking into making a child theme before making any edits to the theme file. If you make changes to the parent, any future version updates will overwrite your updates.