Jump to content
Sign in to follow this  
andywriter

Adding Google +1 button

Recommended Posts

andywriter

Hi all, non-technical person here :) I want to add the Google plus One tag to the head of my Platform Pro site. How do I do that?

Share this post


Link to post
Share on other sites
catrina

There is a plugin for Google+ here: http://wordpress.org/extend/plugins/plus-one-button/ Once it's installed, it can be implemented using a hook. For more info on how hooks are set up, please see here: http://www.pagelines.com/docs/base-child-theme


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
andywriter

Hi Catrina, I tried to follow the hook video but it's going over my head. In order to try to understand better, I copied the coding for the Stumble upon icon which was given in the demo and pasted it into the theme function.php page which resulted in a fatal error. I immediately removed the coding but the fatal error has remained. Help!!

Share this post


Link to post
Share on other sites
catrina

Can you still access your Dashboard or is the error preventing you from doing that?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
andywriter

Yes, I'm still in the settings page where I made the fatal error.

Share this post


Link to post
Share on other sites
andywriter

Catrina, this is the fatal error message: Fatal error: Cannot redeclare add_icons_to_branding() (previously declared in /home/buzztr00/public_html/wp-content/themes/platformbase/functions.php:32) in /home/buzztr00/public_html/wp-content/themes/platformbase/functions.php on line 46

Share this post


Link to post
Share on other sites
catrina

You'll need to re-add the functions.php file to the theme folder. Get a hold of the theme folder download from your Launchpad (pagelines.com/launchpad) and copy and paste the functions.php file from that folder into the same destination in the folder where your current theme files are. The error should go away after refresh. Also, please paste what code you added that caused the error.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
andywriter

OK - trying that now Here's the code I added: // add_action('hook_name','function name'); add_action('pagelines_branding_icons_end', 'add_icons_to_branding'); // function name function add_icons_to_branding(){ // what the function does??“in this case adds a stumbleupon icon to the header of your theme. The class referenced in the link can be seen in the style.css // and is the image from the CSS is placed in the images folder ?> <?php }

Share this post


Link to post
Share on other sites
catrina

Okay, the first step is to determine which hook you need to use and to find out, all you need to know is where you want to put the Google+ button. Since you want to put it in the header on the right side, you'll need to look at the list of hooks available for that part of the header. This list is accessible by going to Settings > Theme Options > Template Setup > Site Header > Site Branding > Advanced Setup but not all hooks are listed here (including the one you're looking for), which is this one: pagelines_branding_icons_start This is the hook you're looking for since you want the Google+ button to display on the right side of the header. As a result, the beginning code will look like this:

// add_action('hook_name','function name');
	add_action('pagelines_branding_icons_start', 'googleplus_button');
	
	// function name
	function googleplus_button(){

I've changed the function name (add_icons_to_branding) to googleplus_button so that it's easier for you to identify. Does that make sense so far?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
adventuremaui

"you'll need to look at the list of hooks available for that part of the header. This list is accessible by going to Settings > Theme Options > Template Setup > Site Header > Site Branding > Advanced Setup but not all hooks are listed here (including the one you're looking for)" I am struggling with hooks ... not getting them to work but finding a definitive list of all available hooks. Telling someone they need to look at a list to find available hooks, and then telling them the one they are looking for isn't there ... this is the reason why some people are saying that Platform Pro isn't user friendly. Where is THE LIST???

Share this post


Link to post
Share on other sites
andywriter

Hi Catrina, You're going to have to walk me through this like an idiot. I'm really nervous now and my site is unaccessible :( I have the downloaded functions.php file - what programme do I use to open it with? Where will I find the destination folder where my current files are?

Share this post


Link to post
Share on other sites
catrina

You'll need to add the functions.php file to your theme folder and then it can be accessible through your Dashboard. Do you have FTP access available through your hosting service?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
andywriter

Yes I do have access to FTP account

Share this post


Link to post
Share on other sites
adventuremaui

Hi Andrea, FTP the functions.php file from the PlatformBase Theme to the wp-content/themes/platformbase folder found in your Wordpress installation. Catrina, any definitive list of hooks anywhere???

Share this post


Link to post
Share on other sites
andywriter

Okay, file uploaded, fatal error gone and site returned. Thank you Catrina for hand holding me through this process and thanks Kevin. Needless to say, I still don't have my Google Plus One button and quite frankly, I think I'd rather do without it - it's too complex to install!

Share this post


Link to post
Share on other sites
adventuremaui

Andrea, if you edit the functions.php file and break your site by making a small typo in the code and you can't access wp-admin, there is one other alternative to uploading a fresh copy of functions.php ... you can also edit this file and correct the typo by using the file manager built into your web host's control panel.

Share this post


Link to post
Share on other sites
[Deleted User]

Hey Andrea I added the below code to the base_sections in the function.php file in the child theme

add_action( 'wp_head', create_function('','echo "<script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script>";'));
	
	add_action( 'pagelines_branding_icons_start', create_function('', 'echo "<span class='gp1'><g:plusone></g:plusone></span>";'));
	

Hope you can use this :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×