Title: Hooks Widgets
Last modified: August 19, 2016

---

# Hooks Widgets

 *  Resolved [cableghost](https://wordpress.org/support/users/cableghost/)
 * (@cableghost)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/)
 * I would like my theme to automatically insert a specific disclaimer in the post
   footer for posts in a certain category.
 * I have a few themes that have built these hooks in as optional widgets, however,
   the theme I am using for this project does not have those widgets.
 * Is there a generic hooks widget plug-in or an easy way to accomplish this? Note
   that my php skills are not great.
 * -Scott

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

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458907)
 * I’m not certain that you can do exactly what you described. Usually the ‘blog’
   page displays posts of all categories, so you could not have the disclaimer for
   only specific categories on such a page.
 * However, if you are talking about an archive page, or a category-specific page,
   then you can do this.
    - Create a new footer.php file named footer-disclaimer.php with your disclaimer
      in it.
    - Change the template file to check for the category like this:
    - change `<?php get_footer(); ?>` to:
    -     ```
          <?php
          if ( is_category('The Special Category') ) :
            get_footer('disclaimer');
          else :
            get_footer();
          endif;
          ?>
          ```
      
 *  Thread Starter [cableghost](https://wordpress.org/support/users/cableghost/)
 * (@cableghost)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458962)
 * Thanks vtxyzzy
 * I actually use a plug-in called Widget Context, where you can specify the category
   for which a widget should be shown. My problem is that I only have sidebars in
   this theme that accept widgets.
 * When I say footer, I’m not referring to a page’s main footer, I am referring 
   to the section after the content. Like what the Post Footer Plug-in does for 
   posts. I suppose, I could hack that code and enter the disclaimer if/else statement.
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458967)
 * I am not familiar with the Post Footer Plugin, so I’m afraid I can’t help with
   that.
 *  [PBP_Editor](https://wordpress.org/support/users/pbp_editor/)
 * (@pbp_editor)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458968)
 * You can just run a category conditional and place that after the
    <?php the_content();?
   >
 *     ```
       <?php if (in_category('id') ):
       	  // we're in Special Category ?>
       <p>This is where the disclaimer goes.</p>
       <?php endif; // end the if ?>
       ```
   
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458969)
 * Then it wouldn’t be in the footer, it would be inside the loop, which isn’t inside
   the footer.
 *  [PBP_Editor](https://wordpress.org/support/users/pbp_editor/)
 * (@pbp_editor)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458970)
 * cableghost clarified that he is not referring to the footer of the page but the
   inline content of the post.
 * > cableghost “When I say footer, I’m not referring to a page’s main footer, I
   > am referring to the section after the content. Like what the Post Footer Plug-
   > in does for posts. I suppose, I could hack that code and enter the disclaimer
   > if/else statement.”
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458971)
 * Yes indeed you are correct, and i do stand corrected… apologies for not reading
   more thoroughly before.. 😉
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458983)
 * As an alternative to modifying every loop, consider adding a filter by pasting
   code like this in your functions.php:
 *     ```
       <?php function mam_filter_content ($content) {
          if ( in_category('39') ) {
             $content .= '<div class="disclaimet">';
             $content .= 'Here is the text of the disclaimer';
             $content .= '</div>';
          }
          return $content;
       }
       add_filter('the_content','mam_filter_content');
       ?>
       ```
   
 *  Thread Starter [cableghost](https://wordpress.org/support/users/cableghost/)
 * (@cableghost)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458984)
 * Thank you [@vtxyzzy](https://wordpress.org/support/users/vtxyzzy/) and [@pbp_editor](https://wordpress.org/support/users/pbp_editor/),
 * Both of your options work. My disclaimer actually shows after a couple of other
   plug-ins, but it shows.
 * Pic: [http://9001links.info/files/disclaimer.jpg](http://9001links.info/files/disclaimer.jpg)
 * PS. how may I add multiple categories? I tried comma separated, but that does
   not appear to work.
 * -Scott
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458985)
 * Use multiple categories like this:
 * `if ( in_category(array(44,16,32)) ) {`
 * You can control the order of the filters to some extent by using a priority. 
   Most plugins will use the default of 10. You can have your filter execute first
   by using a lower priority:
 * `add_filter('the_content','mam_filter_content',9);`
 *  Thread Starter [cableghost](https://wordpress.org/support/users/cableghost/)
 * (@cableghost)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458987)
 * Perfect y’all, that worked.
 * -Scott
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458989)
 * Glad it worked. Now, please use the dropdown at top right to mark this topic ‘
   Resolved’ (but you don’t need to post a new reply).

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

The topic ‘Hooks Widgets’ is closed to new replies.

## Tags

 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 12 replies
 * 4 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/hooks-widgets/#post-1458989)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
