I am using a plugin which has the following function: See end of question.
And I've created a hook in my template file:
<?php custom_hook(); ?>
And this is what I have in my functions.php
function custom_hook() {
do_action('custom_hook');
echo 'Custom Hook works!';
}
add_action('custom_hook', 'wnw_overall_rating_comments', 1);
I am curious, as why this isn't loaded. I have even edit the add_action to the plugin to see if my filter works,
add_action('custom_hook','wnw_overall_rating_comments');
But no luck.
Am I missing something here?
add_action('the_content','wnw_overall_rating_comments');
function wnw_overall_rating_comments($content)
{
global $post,$rating_table_name,$wnw_multi_rating_table,$multi_rating_image_on,$multi_rating_image_off,$multi_rating_image_half,$wpdb;
if($post->type != 'page')
{
//some function
}
return $content.$rating_value;
}else
return $content;
}
custom_hookthenechoin your template? Btw: Theadd_action()call should reside in your plugin. Not in the theme. – kaiser Oct 14 '12 at 19:33custom_hookin one code snippet andthe_contentin another... So which one is it? – Rarst♦ Oct 14 '12 at 19:33<?php do_action('custom_hook'); ?>And add the actionadd_action('custom_hook','wnw_overall_rating_comments');on the plugin. That didn't work as it should. I'm trying to understand why it didn't pulled. – Mohd Rafie Kamaruzaman Oct 16 '12 at 13:26echo... And please answer @Rarst question. Thanks. – kaiser Oct 16 '12 at 13:31the_contentand I want it to execute at thecustom_hookBut which bit should I echo as you suggest? Pardon my lack of knowledge. – Mohd Rafie Kamaruzaman Oct 16 '12 at 13:47