-4

This is my site: http://classichits.ie/

I want to link the background image to another page.

This is the code I have so far:

body.boxed-layout {
   background-image:url(<?php echo get_site_url(); ?>/wp-content/uploads/2016/01/bg4-1.jpg) !important;
   background-size:cover !important;
   background-repeat:no-repeat !important;
   background-position:center center;
}

The CSS is inline. How would I go about linking the background image to a different page?

  • 1
    I'm not totally sure what your question is? Do you want the background to be clickable like an <a> tag? Or do you want to change the background to another image? – Jeroen Jan 25 '16 at 10:23
  • Oh. My apologies for that. I want the side images to be clickable. Yes like the anchor tag. – Nauman Tanwir Jan 25 '16 at 10:26
  • If the php echo is inside your style.css it will not work – Stephen Jan 25 '16 at 10:27
  • @CoderSte Ohk. So, how can I fix it. I am sorry, I am kinda newbie, dont know much. – Nauman Tanwir Jan 25 '16 at 10:28
  • @CoderSte He has the CSS inline, so that will in fact work. – Jeroen Jan 25 '16 at 10:28
1

I took a look at your site, and are you sure you dont want to make the .wrapper clickable? boxed-layout is your whole site, so if you made that clickable the whole site would be a link.

However, if I look at your question, the answer would be to use jQuery.

<script>
$(".body.boxed-layout").click(function(){
window.location = "http://link/to/other/page/";
});
</script>

Note that this probably is not what you want!

Are you sure you don't want to make the http://classichits.ie/wp-content/uploads/2016/01/leftside.png clickable?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.