Add custom hook(filter and action)
-
Hello All,
How to add custom hook in WordPress?
Here what I’ve tried before,# add action in functions.php
add_action('my_logo', 'my_logo');
function my_logo($logo) { echo $logo; }
# do action in template file
$logo = '<img src="PATH"/>'; do_action('my_logo', $logo);
Now I want my logo wrapped by adding filter to my_logo,
add_filter('my_logo', 'modified_logo');
function modified_logo($logo) { $logo = '<span>'.$logo.'</span>'; return $logo; }
But not getting expected result.
Any help appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add custom hook(filter and action)’ is closed to new replies.