admin管理员组文章数量:1327487
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.
本文标签: pluginsHow to laod wpenqueuestyle to another header i created my self
版权声明:本文标题:plugins - How to laod wp_enqueue_style to another header i created my self 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742205787a2432788.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论