Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Test Test
Test Test
617 Points

How do I go about adding a different stylesheet to a another page in word press?

I have been told to copy and paste and rename the header and then attach the new stylesheet to the header and then attach that to the template but nothing I try sees to be working. Any help or insight would be great.

Thanks, Ryan

chai yee xian
chai yee xian
6,814 Points

you could try use simple custom css plugin https://wordpress.org/plugins/simple-custom-css/ then use class/id to style your elements

You could try writing this on your functions.php:

if ( is_page( X ) ) {
wp_enqueue_style('stylesheet2', get_template_directory_uri() . '/style.css' );
}

Read more her: https://codex.wordpress.org/Conditional_Tags https://developer.wordpress.org/reference/functions/wp_enqueue_style/

Her is a very short explanation: "X" her you must write the ID or the slug of your page. | "stylesheet2" can be other name of your choice | "/style.css" Her you say where the css file is.

Test Test
Test Test
617 Points

Thanks I will give it a go.

My main goal is to can multiple landing pages that have different looks to them in word press but nothing seems to be working right. This is what I have followed.

http://wpgarage.com/wordpress-as-cms/using-different-style-sheets-for-different-templates/

and I get this error message :

Warning: include(/home/vhubaxis/public_html/vaxishub/wp-content/themes/vaxishubryans-test.php): failed to open stream: No such file or directory in /home/vhubaxis/public_html/vaxishub/wp-content/themes/vaxishub-child/ryans-test.php on line 18

Warning: include(): Failed opening '/home/vhubaxis/public_html/vaxishub/wp-content/themes/vaxishubryans-test.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/vhubaxis/public_html/vaxishub/wp-content/themes/vaxishub-child/ryans-test.php on line 18

So I am a little confused as to why it isn't working properly.

Thanks Ryan

Test Test
Test Test
617 Points

Thanks Flavia,

Unfortunately that did not work either.

1 Answer

Have you tried to look on CONSOLE tab on your browser? Maybe you can se where the problem is. You could also paste you code her, so we can have a better idea of what´s going on.