this is what I put in:
function infoLegalPrivacy_style() {
if( is_page_template[COLOR="#FF0000"]('legalSub.php','privacySub.php')[/COLOR] ) :
wp_register_style('my-style', get_stylesheet_directory_uri() . '/css/infoLegalPrivacy.css', array(), '', 'all' );
wp_enqueue_style( 'my-style' );
endif;
}
add_action('wp_enqueue_scripts', 'infoLegalPrivacy_style');
but while the legalSub page recognizes the appropriate css the privacySub doesn’t.
Did I put it in incorrectly? is there a diff way. Or is it one by one?
thx
D
function infoLegalPrivacy_style() {
if( is_page_template[B]('legalSub.php' || 'privacySub.php') [/B]) :
wp_register_style('my-style', get_stylesheet_directory_uri() . '/css/infoLegalPrivacy.css', array(), '', 'all' );
wp_enqueue_style( 'my-style' );
endif;
}
add_action('wp_enqueue_scripts', 'infoLegalPrivacy_style');
|| is the php operator for “or”, and the function is_page_template is either true or false, so this might work. I haven’t tested it though.
WordPress is in PHP, any code you write is in PHP. is_page_template() accepts only one parameter so why are you forcing more than one into it?
function infoLegalPrivacy_style() {
if( is_page_template( 'legalSub.php' ) || is_page_template( 'privacySub.php' ) ) {
wp_register_style( 'my-style', get_stylesheet_directory_uri() . '/css/infoLegalPrivacy.css', array(), '', 'all' );
wp_enqueue_style( 'my-style' );
}
}
add_action( 'wp_enqueue_scripts', 'infoLegalPrivacy_style' );