Custom css file for all pages under a specific url in wordpress
-
I have a website that has 2 sections each with different css and specific urls (ie. testsite.com/one/ and testsite.com/two/) I need to apply specific style sheets to each of those urls and all paths falling under those (ie testsite.com/one/test testsite.com/one/test2 and so forth) so for testsite.com/one/* all would get a css file named one.css and for testsite.com/two/* all would get a css file names two.css.
<?php function wpdocs_theme_name_scripts() { if ( is_page( 'two') ) { // If page matches, then load the following files wp_enqueue_style('two', get_template_directory_uri().'/two.css',false,'1','screen' ); // If the condition tag does not match... } else { } } add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );?>
Problem with this is that it only applies the css file to testsite.com/two and nothing past that for example testsite.com/two/xx or testsite.com/two/bbb I need to get the css file to apply to every directory including and following testsite.com/two/ Does that make sense?
- The topic ‘Custom css file for all pages under a specific url in wordpress’ is closed to new replies.