How would you add a hyperlink to a BG img using CSS? - php

CSS
header.site-header .wrap {
background: url(http://jadeluxurycondos.com/jadeluxurycondos-new/wp-content/uploads/2014/04/header-banner.jpg) right top no-repeat;
}
This is what I am working with.
Any insight would be grateful.
Here is the home.php code.

You cannot do this using CSS.
What you've done here is just passed the URL for the background.
If you want to add a link to the image, you can do this either by using a pair of anchor tags.
EG:
Add this in your HTML :
<a href='#'>
<img src="...." />
</a>
OR by adding a click event on to the div.
EG:
$(document).ready(function(){
$('header.site-header .wrap').click(function(){
window.location.href = "Link";
});
});

You could do something simpler:
<div>
<a href="#your-link" target="_blank">
<img src="http://jadeluxurycondos.com/jadeluxurycondos-new/wp-content/uploads/2014/04/header-banner.jpg" width="740px" height="104px" alt="Some other title" title="Some title" />
</a>
</div>
This creates a link that is an image.
EDIT after more info came to light.
From what I've gathered so far... you're using the "Open Floor Plan" Theme for Wordpress. (Maybe ask them for support? After all you paid for a theme.)
The simple method and recommended:
That theme appears to have a widget position at the top right. Why not use that to add your banner-link?
The hard-way hacking not-recommended method:
In wordpress you can edit the theme files (not recommended) by going to Appearance then Editor. This will open up the theme editor view and on the right side you'll see all the files of the currently active theme. You then could search those files for the HTML tag and add the above modifications.
The file that could have what you're looking for could be the header.php or index.php, but if it isn't there just sift through the other files until you find it.
The html markup would look something like this:
<header class="site-header">
<div class="wrap">
It will contain more stuff in here...
</div>
</header>
It will probably contain a lot more classes and PHP code...
The Widget Method
Add your banner code in a Text widget. You can add the CSS styling in-line, so that you won't have to upload anything else.
Add the CSS property for the parent container:
<style>header.site-header .wrap { position:relative; }
Then add the CSS for your element:
.mybanner { position:absolute; top:0; right:0; z-index:1; }
/* the widget with the social icons will probably need z-index aswell */
.CLASS-of-other-widget { position:relative; z-index:2; }
</style>
Now add your HTML code:
<div class="mybanner">
<a href="#your-link" target="_blank">
<img src="http://jadeluxurycondos.com/jadeluxurycondos-new/wp-content/uploads/2014/04/header-banner.jpg" width="740px" height="104px" alt="Some other title" title="Some title" />
</a>
</div>
Please note that with the z-index, the other widget will cover the banner and the ability to click it. You could simply use another position for that widget and just have the banner there.

Hi all and thank you for the help.
I have found a solution. I left the image on the BG, then added a widget to the top right of the page where the image (banner sits), then added a text box to the widget area and added this
<div class="topbanner" onclick="window.location='http://jadeluxurycondos.com/jadeluxurycondos-new/jade-signature/'" style=" height: 102px;left: 37.5%;position: absolute;top: 0; margin-top: 32px;width: 585px;cursor: pointer;"><div>
The image appears to be clickable. Check here to see it in action.

Related

Placing icon inside PHP code on Wordpress

I'm trying to place a custom section in the Astra Wordpress Theme's header under a specific condition, with Custom Layouts feature, but I couldn't manage it properly. The thing is, I wanted to place the location of the featured header images in the header section with a custom icon. The thing is, I'm using the "caption" section of the Wordpress image. I can display only the caption section if it's not empty. My PHP knowledge is not perfect, but I've done the research and found nothing.
Example: top right corner
I could display the caption section of the image but couldn't place the icon before the caption text.
I've tried many combinations, but still nothing.
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css">
<div class="featured-image-caption-for-header"
style="position: absolute; top: 10px; right: 10px; text-align: right; font-size: 12px; color: #3A4115;">
<?php $featured_image_caption = the_post_thumbnail_caption(); if( $featured_image_caption ): ?>
<i class="uil uil-camera"> </i>
<?php echo esc_url( $featured_image_caption ); ?>
<?php endif; ?>
</div>
My main goal is to display the icon before the caption text only when the caption section of the image is filled.
Placing <i class="uil uil-camera"></i> code before the caption text in Wordpress' photo editor displays the icon but this is what I really wanted. Still working on a better solution.
Photo Editor
Output

Changing logo image by changing website language

I'm working on our company website. We want to make our logo image change, by changing website's language.
this is where our logo code located inside < header > tag:
<nav id="nav" class="menu-btn-parent">
<a href="/" class="logo"><h1>
<img src="<?php echo get_template_directory_uri()?>/assets/img/common/logo-small.png">
</h1></a>
</nav>
How can I make /assets/img/common/logo-small.png image to change by changing website language from mysiteurl/en to mysiteurl/de ?
We are using wordpress.
Thank you.
We are using qTranslate plugin.
add this in your css
.l-header #nav .logo h1{background: none!important;}
.l-header #nav .logo img{opacity:1!important;}

Adding hyperlink dynamically to images using jquery cycle plugin for transitions

I am working on a slideshow using the jquery cycle plugin for transitions.
Now all works fine till I add a hyperlink to the image.I am trying to add a hyperlink if a user wishes to add so i have a set button for each image in my console.If a user selects a hyperlink and clicks set,it should be set.Now the hyperlink is set correctly,but,then the transitions are applied to the anchor tags instead of the img tags.
When I set the link the img tag is wrapped inside the anchor tag like this.
<a href="www.google.com" id="link" class="link">
<img id="imgBoxRot_1_1" style="width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; display: none; z-index: 3; opacity: 0;" src="http://localhost/images/layout/slideShow/gallImg1.jpg">
</a>
I create this anchor tag dynamically like this,and append it to the image.
var newA = document.createElement("a");
newA.setAttribute("id","lnkImgRotImg_"+iCount+"_"+idT);
newA.setAttribute("href",document.getElementById(lnk).value);
newA.setAttribute("class","aTransLink");
newA.setAttribute("target","_blank");
Before setting the anchor tag the plugin works fine and transitions are applied,but after adding a anchor to image,the transitions are applied to the anchor tag instead of the image.How can I fix this?
Thanks for the time.
After studying the plugin documentation I learned that,the plugin is default applied to the first tag that is inside the div to which it is applied.
That is,if we have
<div class="">
<img></img>
<img></img>
</div>
Now,if I wrap an anchor around the image like this,
<div class="">
<a href="">
<img></img>
</a>
<img></img>
</div>
The plugin gets confused between an image tag and an anchor tag and applies the transitions to the anchor instead of the image tag(as it is the first after the div to which the cycle plugin is applied). Therefore,I wrapped all the images initially inside an anchor tag each(Earlier I added anchors dynamically) and applied the plugin on the anchors itself instead of image tag.

How do I extract Joomla intro image outside intro text in order for it to show on the left of title and other info in featured page?

I am trying to achieve a custom layout for my featured article page on Joomla in order to make a nice blog layout with my custom design made on Photoshop.
This is the look I am trying to achieve: http://i48.tinypic.com/2ztbx54.png
This is the look I am getting at the moment: http://i49.tinypic.com/1ibn5w.png
Rest of the layout would not be a problem since it's pretty easily modifiable, however, the problem where I am stuck at the moment is the intro image. I want it to be on the left from the article title, some information and intro text like shown in the first image.
Is it possible to extract the image out of intro text in order to place it where needed?
Help will be appreciated, thanks!
Firstly, my comment was just a joke.
Now, for the question: your image is sitting in the div item column-1 when it should be sitting in the the div above that (the container of item column-1) which is items-row cols-1 row-0.
So this:
<img src="/images/Articles/macbookpro-review-01-top.jpg" width="200" height="200" alt="macbookpro-review-01-top" style="float: left;">
Cannot go in <div class="items-row cols-1 row-0"> or <dl class="article-info"> which is what you are currently doing.
It needs to be sitting in the outer div. So it should be in <div class="items-row cols-1 row-0">. So like this:
<div class="items-row cols-1 row-0">
<img src="/images/Articles/macbookpro-review-01-top.jpg" width="200" height="200" alt="macbookpro-review-01-top" style="float: left;">
//...and the rest of your stuff
In your css file add the following code to get you started off:
.article-info {
float:right;
}
h2 {
text-align: right;
}
.item.column-1 img {
margin-top: -50px;
}
.article-info-term {
padding-left: 40px;
}
Also, take away the margin: 0px; you have added to the images.
This is what the result will be:
http://i735.photobucket.com/albums/ww355/lodder16/stack_image.png
Hope this helps

Wordpress Issue: Sidebar is allowing for link to expand into the footer

I am not sure how to phrase this as it is boggling my mind. I have a sidebar widget that is setup to show some images and a link. It has a div and it is closed within the actual widget.
Below I am pasting the actual code I can see when I inspect the element via Chrome.
</a><li><img src="/wp-content/themes/newscast/images/skin1/socialside.jpg" style="visibility: visible; opacity: 1; "></li><a href="/socialmedia/">
</a></ul><a href="/socialmedia/">
</a></div></div><a href="/socialmedia/">
</a></div></div><a href="/socialmedia/">
</a></div></div>
The first line of code is below and that is in the widget
<li><img src="/wp-content/themes/newscast/images/skin1/socialside.jpg" style="visibility: visible; opacity: 1; "></li><a href="/socialmedia/">
</a></ul></div>
The code below is being added somehow and I am completely inept of figuring out why haha
<a href="/socialmedia/">
</a></div></div><a href="/socialmedia/">
</a></div></div><a href="/socialmedia/">
</a></div></div>
Have a look at the Sidebar on the right and then hover over the footer below. The entire footer is getting the link somehow.
Now what makes this harder, for me, to figure out is if I remove the widget that is calling this sidebar it works fine. The 1st widget, the links, works fine and does not give out any links to anywhere else
Any help would be great.
More than likely you are not closing your <a> tags in the text widget, so the browser is trying to close them for you by guessing.
Check the text widget and make sure you have a </a> for every <a> tag.

Categories