Title: Add Custom Text using Hook
Last modified: January 13, 2020

---

# Add Custom Text using Hook

 *  Resolved [Mwale Kalenga](https://wordpress.org/support/users/mwalek/)
 * (@mwalek)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-custom-text-using-hook/)
 * Guten Tag,
 * Thanks for this great plugin. I would like to add my own text after categories
   are listed using “rpwwt_list_cats”. This is not working, how can I do this?? 
   Thanks
 * My Code:
 *     ```
       function rpwwt_custom_text() {
           echo 'hello world!';
       };
       add_action('rpwwt_list_cats', 'rpwwt_custom_text');
       ```
   
 * Kind regards,
    Mwale

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Contributor [Martin Stehle](https://wordpress.org/support/users/hinjiriyo/)
 * (@hinjiriyo)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-custom-text-using-hook/#post-12319116)
 * 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?
    -  This reply was modified 6 years, 4 months ago by [Martin Stehle](https://wordpress.org/support/users/hinjiriyo/).
 *  Thread Starter [Mwale Kalenga](https://wordpress.org/support/users/mwalek/)
 * (@mwalek)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-custom-text-using-hook/#post-12319152)
 * 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
 *  Plugin Contributor [Martin Stehle](https://wordpress.org/support/users/hinjiriyo/)
 * (@hinjiriyo)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-custom-text-using-hook/#post-12319405)
 * You’d add the same code with another hook name:
 *     ```
       function rpwwt_custom_text() {
           echo 'hello world!';
       };
       add_action('rpwwt_categories', 'rpwwt_custom_text');
       ```
   
 *  Thread Starter [Mwale Kalenga](https://wordpress.org/support/users/mwalek/)
 * (@mwalek)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-custom-text-using-hook/#post-12319638)
 * I pasted the exact snippet in my functions file. Nothing happens on the front-
   end. Any idea why?
 *  Plugin Contributor [Martin Stehle](https://wordpress.org/support/users/hinjiriyo/)
 * (@hinjiriyo)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-custom-text-using-hook/#post-12325847)
 * With the new version 6.7.0 you can take advantage of the new hook `rpwwt_categories`.
   Some advices:
    1. Do not use any `echo` statement in the filter function. Instead append all strings
       to a new one and `return` it.
    2. 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](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/reviews/).
 *  Thread Starter [Mwale Kalenga](https://wordpress.org/support/users/mwalek/)
 * (@mwalek)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-custom-text-using-hook/#post-12326422)
 * Thanks so much Martin!
 * It really is an amazing plugin, 5 stars from me!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Add Custom Text using Hook’ is closed to new replies.

 * ![](https://ps.w.org/recent-posts-widget-with-thumbnails/assets/icon-256x256.
   png?rev=2478511)
 * [Recent Posts Widget With Thumbnails](https://wordpress.org/plugins/recent-posts-widget-with-thumbnails/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/recent-posts-widget-with-thumbnails/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/)
 * [Active Topics](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/recent-posts-widget-with-thumbnails/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Mwale Kalenga](https://wordpress.org/support/users/mwalek/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/add-custom-text-using-hook/#post-12326422)
 * Status: resolved