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 From Bootstrap to WordPress Setup a Bootstrap Theme Creating Bootstrap Navigation in WordPress

mrgreen
mrgreen
4,547 Points

Need help, error when placing <?php body_class(); ?>>

Hi, I got this error in index page showing

class="home page page-id-4 page-template-default logged-in admin-bar no-customize-support">

which is below navigation.

Thanks

5 Answers

Caroline Hagan
Caroline Hagan
12,612 Points

Hi mrgreen Sorry what was the error you got?

mrgreen
mrgreen
4,547 Points

hi, I don't think its a script error, it just showing this

" class="home page page-id-4 page-template-default logged-in admin-bar no-customize-support"> "

at the page, when I place <?php body_class(); ?>> tag , showing on tutorial "Creating Bootstrap Navigation in Wordpress" ..not sure it is from wp or bootstrap css.

Hi,

Why does your scrip <?php body_class(); ?>> include ``

`` at the end?

mrgreen
mrgreen
4,547 Points

Hi,

Just learning from the tutorial..

Caroline Hagan
Caroline Hagan
12,612 Points

php body_class does is doing the correct thing - Wordpress is displaying classes that are relevant to that page - see docs at http://codex.wordpress.org/Function_Reference/body_class

If you don't want it in your project, just remove the PHP, however it is handy for identifying and targeting specific pages for styles.

mrgreen
mrgreen
4,547 Points

I see, so it is use to identify specific pages. ok, thanks

The php body class tag is within the <body> tag. Incorrect way = <body> <?php body_class(); ?>> Correct way = <body <?php body_class(); ?>>

Hope this helps...

Correct way = <body <?php body_class(); ?>> l solved my problem.