WordPress tutorial, We will show how to change background for specific page and category in wordpress theme. achieve using conditional tags.
change background for specific page and category in wordpress
Many times clients demands for different background color or different images as a background. We can very easily achieve this using wordpress conditional tags.
You can use following code in your page.php or category.php file which is present in wordpress theme. If you want to change the background for specific page then open page.php file from theme folder.
<body <?php if(is_page('contact us')) echo 'class="contact_us"';?>>
Use following css code in your style.css file
.contact_us{ .background-color:#ccc; } .php_category{ .background-color:#181818; } If you want to use different background for your category then use following code. <body <?php if(is_category('php'')) echo 'class="php_category"';?>>
I don not know in category.php where to add exactly this line
<body >