Hi all. I'm very new to WP and editing my first theme (an edit of the Sandbox Theme.) I come from a design background, so my PHP is not very impressive, which is probably why I have hit a roadblock.
What I want to do is set the background image of <body> in my CSS. The theme links style.css to the header, and style.css links to another CSS file, which I have as a php file (myedit.php) because I wanted some of the background images to randomise.
The problem is that it doesn't work. My first attempt was to have a simple background image in the body tag, like so:
body {
background: url(<?php bloginfo('template_directory'); ?>/images/bg-images/bgimage.jpg);
}
This makes the all everything defined in 'myedit.php' not work, it's as if the file isn't even there. Moving 'body {}' around, I found that it's everything below the <?php bloginfo('template_directory'); ?> which is blanked out.
Anyone have any idea why this is happening? I can use other bits of PHP code in 'myedit.php', but calling bloginfo('template_directory') seems to give it a headache. If I cannot use bloginfo to get the directory, does anyone else have an alternative way that I can set background images in the CSS? I have also tried hard-wiring it (wp-content/theme/sandbox/images/bg-images/bgimage.jpg) which did not work either.
Thanks for reading, your help is much appreciated!