Javascript wordpress-为不同页面添加自定义样式表

Javascript wordpress-为不同页面添加自定义样式表,javascript,php,html,css,wordpress,Javascript,Php,Html,Css,Wordpress,我创建了名为“FrontPage.php”的自定义主页,然后在header.php文件中添加了另一个带有自定义css和JS文件的页面,如下所示: <?php function my_styles_method() { if (is_page_template('front-page.php'==TRUE){ // Register the style like this for a theme: wp_register_style( 'm

我创建了名为“FrontPage.php”的自定义主页,然后在
header.php
文件中添加了另一个带有自定义css和JS文件的页面,如下所示:

<?php 
function my_styles_method() {
        
    if (is_page_template('front-page.php'==TRUE){  
    // Register the style like this for a theme:  
    wp_register_style( 'my-custom-style', get_template_directory_uri().'/includes/marquee.css');  

    // enqueue the stule  
    wp_enqueue_style( 'my-custom-style' );  
    
    }
    

    enter code here
    // Register the style like this for a theme:  
    if (is_page_template('our-story.php'==TRUE) {
    wp_register_style( 'my-custom-style', get_template_directory_uri().'/includes/main.css');  

    // enqueue the stule  
    wp_enqueue_style( 'my-custom-style' );
    }
}  
add_action( 'wp_enqueue_scripts', 'my_styles_method' ); 

?>
试试这个

<?php 
    function my_styles_method() {

        if (is_page_template('front-page.php')==TRUE){  
        // Register the style like this for a theme:  
        wp_register_style( 'my-custom-style', get_template_directory_uri().'/includes/marquee.css');  

        // enqueue the stule  
        wp_enqueue_style( 'my-custom-style' );  

        }


        //enter code here
        // Register the style like this for a theme:  
        if (is_page_template('our-story.php')==TRUE) {
        wp_register_style( 'my-custom-style', get_template_directory_uri().'/includes/main.css');  

        // enqueue the stule  
        wp_enqueue_style( 'my-custom-style' );
        }

    add_action( 'wp_enqueue_scripts', 'my_styles_method' ); 

    ?>


//if(is_page_template('front-page.php'==TRUE)应该是if(is_page_template('our-story.php')==TRUE)

第32行周围发生了什么?第32行是if语句{开始的地方..所以…
if(is_page_template('front-page.php'==TRUE){
你能发现错误吗?附言:第二个也一样,如果有……是的,有问题:)谢谢你的帮助如果你想了解,那么选择这个答案作为正确答案我现在面临的问题是,当我这样做时,我的css文件没有被拾取。知道为什么会发生这种情况吗?css在includes文件夹中,名为main.css