Can be used in a template
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<div class="twelve columns about-banner"> <?php $pagename= get_query_var("pagename"); $pagecomp = $pagename.".png"; //echo $pagecomp; echo "<style> .about-banner {background-image: url(http://example.co.uk/mysite/wp-content/themes/mysite2013/img/".$pagecomp.");} </style>"; |
And using a more relative way
1 2 3 4 5 6 7 8 9 |
<?php $pagename= get_query_var("pagename"); $pagecomp = $pagename.".png"; echo "<style> .about-banner {background-image: url('/wp-content/themes/codehaven/img/".$pagecomp."'); height:297px; padding:20px;} </style>"; ?> |