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 trialmrgreen
4,547 PointsNeed 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
12,612 PointsHi mrgreen Sorry what was the error you got?
nnuxiragwh
10,345 PointsHi,
Why does your scrip
<?php body_class(); ?>>
include
``
`` at the end?
mrgreen
4,547 PointsHi,
Just learning from the tutorial..
Caroline Hagan
12,612 Pointsphp 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
4,547 PointsI see, so it is use to identify specific pages. ok, thanks
justinpetersen
2,234 PointsThe php body class tag is within the <body> tag. Incorrect way = <body> <?php body_class(); ?>> Correct way = <body <?php body_class(); ?>>
Hope this helps...
ggdgagagdggg
Full Stack JavaScript Techdegree Student 4,332 PointsCorrect way = <body <?php body_class(); ?>> l solved my problem.
mrgreen
4,547 Pointsmrgreen
4,547 Pointshi, 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.