The hook 'rpwwt_list_cats' takes effect in the categories selection box of that plugin on the backend’s Widgets page.
Recently there is no such hook for the category lists on the frontend. Would a new hook like
echo apply_filters( 'rpwwt_categories', $this->get_the_categories( $r->post->ID ) );
be the right tool for you?
Thanks for your quick response Martin.
I’m not sure.
What would the code for me to add my own ‘hello world’ text look like with the new hook.
Thanks in advance,
Mwale
You’d add the same code with another hook name:
function rpwwt_custom_text() {
echo 'hello world!';
};
add_action('rpwwt_categories', 'rpwwt_custom_text');
I pasted the exact snippet in my functions file. Nothing happens on the front-end. Any idea why?
With the new version 6.7.0 you can take advantage of the new hook rpwwt_categories. Some advices:
- Do not use any
echo statement in the filter function. Instead append all strings to a new one and return it.
- To echo the category list store it in a variable as the first parameter of the filter function and add it to the return string.
So a correct way to use the filter is:
function rpwwt_custom_text( $category_list ) {
return $category_list . '. Hello world!';
};
add_action( 'rpwwt_categories', 'rpwwt_custom_text' );
If you’d like the new feature I will be glad about your review.
Thanks so much Martin!
It really is an amazing plugin, 5 stars from me!