Styling header widget
-
Hy,
where can I style header widget? Basically I want to align widget to top right corner (default is left) and add some space from top border to fit adsense banner over header image. Trying to find that in style.css but unable to find. Current state is without header widget. Of course I will reedit header image after putting banner over it.
http://www.kkciglenica.com/kkciglenica
Thnks in advance 4 any help.
I’m not quite sure I understand what you are trying to do. Are you wanting to move the social sharing icons?
Mod
Thnx Ken.This is exactly what I was looking for.
This is what I was trying to do…
http://www.kkciglenica.com/kkciglenica
Added a div id tag in header.php (just before this:<?php /* Header widget area */) with adsense code in it, and styling it with css (float: right)
Now, the problem is that I changed the graphene header.php, so after upgrade it will probably go to hell ;). I have to put it in child theme somehow…
thnx for help, without this forum I do not think I could make it!
For this, you could use an action hook in your child theme
functions.phpfile.If you look at your
header.phpin your original graphene directory… You will notice different<php do action(); ?>‘s scattered throughout. Create a function in your childfunctions.phpfile and add something like this…For this, I named a function
josh_headercloudand a div idheadercloud.Notice at the bottom the
add action. This is telling the function to first display thedo action( 'graphene_header' )and then directly afterwards it will display thedo action ( 'josh_headercloud' ).Lastly, use your child theme CSS positioning.. create an element, in my case
#headercloud(matching the div id), and assign it properties as needed for positioning.This keeps everything in your child theme and there is no need to alter core files.
Good Luck 🙂
What I’m doing wrong:
1.function adsense-header(){
2. ?>
3. <div id=”adsense-head”>
4. <script type=”text/javascript”><!–
5.google_ad_client = “ca-pub-xxxxxxxxxxxx”;
6./* ciglenica1_468x60 */
7.google_ad_slot = “xxxxxxxxx”;
8.google_ad_width = 468;
9.google_ad_height = 60;
10.//–>
11.</script>
12.<script type=”text/javascript”
13.src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
14.</script>
15. </div>
16. <?php
17.}
18.add_action( ‘graphene_header’, ‘adsense-header’ );
I’m getting syntax error in line 17 , Really NOT much of an PHP experct! Please help.
Lastly, I menage to insert adsense and style it with action hook, but why is my width after theme update gone so wide (to right). So adsense is showing on the far right corner outside of the main content width?
http://kkciglenica.com/kkciglenica
This is happening only when action hook widget is activated. Otherwise it’s OK.
Did it finaly: in chil page function.php insert this:
<?php
function adsense_banner() {
?>
<div id=”adsense-head”>
Adsense code!
</div>
<?php
}
add_action( ‘graphene_header’, ‘adsense_banner’ ); ?>
and style it with css.
I didn’t close tag (?>).
But couldn’t make it with theme action hook widget…
At least I did it myself.;)
Good for you. It’s amazing what a missing question mark can do in your code 😉
Viewing 10 posts - 1 through 10 (of 10 total)
- You must be logged in to reply to this topic.
