how to add a facebook icon next to rss icon at the top of theme
-
Heres what i use (the src are just my own images you can use default ones just get default code from addthis.com):
function graphene_social_icons(){
?>
< a class=”addthis_button_twitter”>< /a>
< a class=”addthis_button_facebook”>< /a>
<?php
}
add_action(‘graphene_feed_icon’, ‘graphene_social_icons’);
Remember tremove the spaces after each <
The reason there are spaces is because otherwise it executes the code in these comments 🙂
getting this error when I try to use the above mentioned with my own css and functions.php in the child theme:
Parse error: syntax error, unexpected ‘}’ in /home1/uglycars/public_html/libertythinkers/wp-content/themes/graphene_child_theme/functions.php on line 5
my child theme style.css:
Code:/*
Theme Name: Graphene Child
Theme URI: http: //example.com/
Description: Child theme for the Graphene theme
Author: Your name here
Author URI: http: //example.com/about/
Template: graphene
Version: 0.1.0
*/
@import url(“../graphene/style.css”);
/* Your modification goes here */.slider_post_entry .addtoany_share_save_container
{
display:none;
}.facebook_icon
{
background: url(“graphene/images/facebook.png”);
width: 2em;
}functions.php
Code:function graphene_social_icons(){
?>
< a class=”facebook_icon”>< /a>
<?php
}
add_action(‘graphene_feed_icon’, ‘graphene_social_icons’);Admin
Your
functions.phpfile must have an initial opening<?phptag and a final closing?>tag. Try this:<?php
function graphene_social_icons(){ ?>
<a class="facebook_icon"></a>
<?php
}
add_action('graphene_feed_icon', 'graphene_social_icons');
?>Admin
@Michael, if you put codes in between backticks (`) in your reply, the codes won’t be parsed.
thanks all..I really appreciate you helping me out with my php noobness.
Syahir,
Need a little help with this one.
I must explain off the bat, that my PHP knowledge is slim to none.
I would like to add a facebook, twitter and youtube icon with links to respective sites right next to the RSS feed icon.
Here is what I’ve done.
functions.php
<?php
function graphene_social_icons(){ ?>
<a class="facebook_icon"></a>
<a class="twitter_icon"></a>
<a class="youtube_icon"></a>
<?php
}
add_action('graphene_feed_icon', 'graphene_social_icons');
?>style.css
#facebook_icon a{
margin:13px 0 0 13px;
float:left;
width:29px;
height:29px;
background:url(images/facebook.png) left top no-repeat;
}
#twitter_icon a{
margin:13px 0 0 13px;
float:left;
width:29px;
height:29px;
background:url(images/twitter.png) left top no-repeat;
}
#youtube_icon a{
margin:13px 0 0 13px;
float:left;
width:29px;
height:29px;
background:url(images/youtube.png) left top no-repeat;
}header.php
<div id="twitter_icon">
<a href="http://www.twitter.com" title="Follow on Twitter" </a>
</div>The twitter icon shows up perfectly with working link, but as soon as I add the facebook or youtube div in the header, I get multiples of each.
I apologize in advance if this looks like a coding nightmare.
I’ve been working on trial and error.
And sorry for digging up a dead thread.
Thanks in advance!
I have also tried to follow what Andrew did.
child function.php
<?php
function graphene_social_icons(){ ?>
<a class="facebook_icon"></a>
<?php
}
add_action('graphene_feed_icon', 'graphene_social_icons');
?>child style.css
/*
Theme Name: Graphene Child
Theme URI: http: //example.com/
Description: Child theme for the Graphene theme
Author: Your name here
Author URI: http: //example.com/about/
Template: graphene
Version: 0.1.0
*/
@import url("../graphene/style.css");
/* Your modification goes here */
.slider_post_entry .addtoany_share_save_container
{
display:none;
}
.facebook_icon
{
background: url("graphene/images/facebook.png");
width: 2em;
}Nothing happens…
Whats missing?
dsol,
I have the facebook and twitter icon on my site which you can see here:
this is what I put in my child functions.php
<?php
function graphene_social_icons(){ ?>
<a href="http://www.facebook.com/pages/Liberty-Thinkers/169018999777818" title="Join Liberty Thinkers on Facebook"><img src="http://yourlink.com" /></a>
<a href="http://www.twitter.com/libertythinkers" title="Join Liberty Thinkers on Twitter"><img src="http://youlink.com" />
</a>
<?php
}
add_action('graphene_feed_icon','graphene_social_icons');
?>if you resize your icons to 29X29 and upload them into your child theme and then link to them, you shouldn’t need to use any css
Thank you so much for the response Andrew. I was starting to think the thread was dead and ignored!
I’ve tried your code in a child functions page but no success.
I’m beginning to wonder if the issue isn’t with the graphene_feed_icon hook.
A search of the original functions.php file for “graphene_feed_icon” returns absolutely nothing.
Any ideas?
Khairul?
- You must be logged in to reply to this topic.
