Jump to content
Sign in to follow this  
gdub01

Adding a hook

Recommended Posts

gdub01

I'm having trouble adding a hook. I installed the plugin 'vote it up' and it asks to submit this code into single.php or index.php: <?php DisplayVotes(get_the_ID()); ?> So I know that I want to add it as a hook to the base theme instead of modifying the platform pro theme. So I tried to follow the example documentation in functions.php in editing the platformbase theme and I wrote this: add_action('pagelines_before_postsinfo', 'DisplayVotes'); function DisplayVotes(get_the_ID()); ?> But I'm getting a parse error. Can you help me? Thanks, Gavin

Share this post


Link to post
Share on other sites
catrina

The hook you created isn't written the correct way. Here is the correct format:

	//add_action('pagelines_branding_icons_end', 'add_icons_to_branding');
	
		// function name
		function add_icons_to_branding(){
	
			
	
		<?php }
		// end function[/code]

	
	This code you wrote: 
[code]function DisplayVotes(get_the_ID()); ?>
...must be replaced with:
function display_votes
Also, "DisplayVotes" in this code:
add_action('pagelines_before_postsinfo', 'DisplayVotes');
...must be replaced with
display_votes

Notice that the name of the function (display_votes) is the same in the top line and the fourth line (just like in the example at the top). Does that make sense?


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

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  

×