Title: Simple Hook Widget
Author: Eddie Moya
Published: <strong>Ọ̀pẹ 9, 2011</strong>
Last modified: Ẹrẹ́nà 15, 2012

---

Ṣàwárí àwọn plugin

![](https://ps.w.org/simple-hook-widget/assets/banner-772x250.png?rev=519129)

Plugin yìí **kò tíì ṣe àyẹ̀wò pẹ̀lú àwọn ìtújáde mẹ́ta pàtàkì tó kẹ́yìn ti WordPress**.
Ó lè jẹ́ pé a kò tọ́jú tàbí ṣe àtìlẹ́yìn fún un mọ́, ó sì lè ní àwọn ọ̀ràn ìbámu
nígbà tí a bá lò ó pẹ̀lú àwọn ẹ̀yà WordPress tuntun.

![](https://s.w.org/plugins/geopattern-icon/simple-hook-widget_f5f5f5.svg)

# Simple Hook Widget

 Láti ọwọ́ [Eddie Moya](https://profiles.wordpress.org/eddiemoya/)

[Ṣe ìgbàsílẹ̀](https://downloads.wordpress.org/plugin/simple-hook-widget.zip)

 * [Àwọn àlàyé](https://yor.wordpress.org/plugins/simple-hook-widget/#description)
 * [Àwọn àgbéyẹ̀wò](https://yor.wordpress.org/plugins/simple-hook-widget/#reviews)
 *  [Ìgbéwọlẹ̀](https://yor.wordpress.org/plugins/simple-hook-widget/#installation)
 * [Ìdàgbàsókè](https://yor.wordpress.org/plugins/simple-hook-widget/#developers)

 [Ìrànlọ́wọ́](https://wordpress.org/support/plugin/simple-hook-widget/)

## Àpèjúwe

This widget allows the user to insert a hook, with a name of their choosing, in 
any sidebar.

The hook can be anything, an existing hook from the WordPress Core, a plugin, a 
theme, or something youÌtumọ̀ Yorùbá: ’ve come up with on the fly. Once the hook
exists, your plugins, your theme, or the WordPress Core to make something happen
with that hook.

This can be used in conjunction with other more complex plugins, to allow you to
trigger a hook from the sidebar (yes, that is intentionally vague). It can also 
serve as a quick alternative to making very simple widgets tied to code from a theme.
Say you have a chunk of code which already exists on your site, youÌtumọ̀ Yorùbá:’
d like to also have it placed in a sidebar, but donÌtumọ̀ Yorùbá: ’t want to make
a widget out of it (since its entirely theme-centric). You could simply hook this
chunk of code to a custom hook and use the Simple Hook Widget to place that custom
hook in the sidebar.

This is clearly not the best method of widget development, but there may be times
where such on option is useful to a developer in a pinch.

#### Update 2.0

 * New filter which allows developers to specify what hooks are available to choose
   from.

Warning: Use this plugin with care. If you are not a developer and donÌtumọ̀ Yorùbá:’
t know what ‘hooks’ are, this plugin is not for you. This plugin will allow you 
to enter _ANY_ hook, and will run it in the sidebar Ìtumọ̀ Yorùbá: – that includes
core WordPress loaded with actions that could result in problems for your site.

### Developer Notes

#### IMPORTANT:

If the ‘simple-hook-list’ is not filtered, the Simple Hook Widget will not show 
a drop down in the widget interface, but instead it will provide an empty text field
allowing a user to enter _ANY_ hook they like.

#### Using the hooks

Here is a simple example of how to use a hook used in the Simple Hook Widget. Its
just like using any other hook in WordPress. Remember, you can do whatever you want
here, you just need to make sure the hook used in the add_action() is the same as
the hook name selected in a particular widget.

Example #1:

    ```
    function simple_hook_super_example() {
        echo "This is my super simple hook widget";
    }
    add_action('example-hook-name-one', 'simple_hook_super_example');


    You can create any number of different widgets by simply writing a function, and adding it as an action to a hook. Here is a similar one as the first, but this is here to illustrate the point.

    Example #2:
    ```

function simple_hook_awesome_example() {

    ```
    //Do whatever you want your 'widget' to do, when the 'example-hook-name-two' hook is chosen.
    echo "This is my awesome simple hook widget";
    ```

}
 add_action(‘example-hook-name-two’, ‘simple_hook_awesome_example’);

#### Creating dropdown of Pre-determined hooks

#### Filter: ‘simple-hook-list’

    ```
    Version 2.0 of the Simple Hook Widget includes the 'simple-hook-list' filter which allows developers to specify a set of hooks which can be selected from the widgets admin panel.

    The function you create should return an associative array where the index is the actual hook's name, and the value is the text that will represent it in the drop down on the widgets panel. 

    Example:
    ```

function simple_hook_example_filter($hooks){
 $hooks = array ( ‘example-hook-name-
one’ => ‘Awesome Widget’, ‘example-hook-name-two’ => ‘Simple Widget’ ); return $
hooks; } add_filter(‘simple-hook-list’, ‘simple_hook_example_filter’);

#### IMPORTANT:

If the ‘simple-hook-list’ is not filtered, the Simple Hook Widget will not show 
a drop down in the widget interface, but instead it will provide an empty text field
allowing a user to enter _ANY_ hook they like.

#### Hook: simple-hook-default

    ```
    This hook allows developers provide a default value for the Simple Hook widget. By default, the default value for the hook, is an empty string.
    Example:
    ```

function simple_hook_example_default($default_hook){
 return ‘example-hook-name-
two’; } ` Note: If filtering ‘simple-hook-list’ to create a drop down, the default
value must match one of the _keys_ in the array passed to the filter Ìtumọ̀ Yorùbá:–
otherwise this default will do nothing.

#### Hook: simplehookupdate_

This widget also contains an internal hook, which will be _your_ hook, prefixed 
with simplehookupdate_. So if you use this plugin to create a hook name ‘testhook’,
the widget, aside from creating the ‘testhook’ in the chosen sidebar location, will
also create a hook called ‘simplehookupdate_testhook’. This hook occurs within the
update method of the WP_Widget class, immediately before $instance is returned.

Not sure how useful this is, but a friend suggested it, so here is it.

## Ìgbéwọlẹ̀

 1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress
 3. In the widgets interface, drag to desired location.
 4. Enter desired hook name or select one from the drop down menu (if there is one).
 5. Enjoy cake.

## FAQ

  Does this plugin work?

Yes

  Is it simple?

Yes

  Is it dishwasher safe?

No.

## Àwọn àgbéyẹ̀wò

Kò sí àwọn àgbéyẹ̀wò fún plugin yìí.

## Àwọn Olùkópa & Olùgbéejáde

“Simple Hook Widget” jẹ́ ètò ìṣàmúlò orísun ṣíṣí sílẹ̀. Àwọn ènìyàn wọ̀nyí ti ṣe
ìkópa sí plugin yìí.

Àwọn Olùkópa

 *   [ Eddie Moya ](https://profiles.wordpress.org/eddiemoya/)

[Túmọ̀ “Simple Hook Widget” sí èdè rẹ.](https://translate.wordpress.org/projects/wp-plugins/simple-hook-widget)

### Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?

[Ṣàwárí koodu](https://plugins.trac.wordpress.org/browser/simple-hook-widget/), 
ṣàyẹ̀wò [ibi ìpamọ́ SVN](https://plugins.svn.wordpress.org/simple-hook-widget/),
tàbí ṣe àgbékalẹ̀ sí [àkọsílẹ̀ ìdàgbàsókè](https://plugins.trac.wordpress.org/log/simple-hook-widget/)
nípasẹ̀ [RSS](https://plugins.trac.wordpress.org/log/simple-hook-widget/?limit=100&mode=stop_on_copy&format=rss).

## Àkọsílẹ̀ àwọn àyípadà

#### 2.0

 * New ‘simple-hook-list’ filter which allows developers to specify what hooks are
   available to choose from in the widget panel.
 * New ‘simple-hook-default’ filter which allows developers to specify a default
   value for Simple Hook Widget.

#### 1.1.1

 * Fixed a packaging problem which made plugin activation fail

#### 1.1

 * Changed the name of the update hook prefix from simplehook_ to simplehookupdate_

#### 1.0

 * Initial commit

## Àkójọpọ̀ Meta

 *  Ẹ̀yà **2**
 *  Ìgbàgbọ́hùn tó kẹ́yìn **ọdún 15 sẹ́yìn**
 *  Àwọn ìgbéwọlẹ̀ tó ṣiṣẹ́ **10+**
 *  Ẹ̀yà WordPress ** 2.8 tàbí ju bẹ́ẹ̀ lọ **
 *  Dánwò dé **3.3.2**
 *  Èdè
 * [English (US)](https://wordpress.org/plugins/simple-hook-widget/)
 * Àwọn àmì
 * [development](https://yor.wordpress.org/plugins/tags/development/)[Hook](https://yor.wordpress.org/plugins/tags/hook/)
   [sidebar](https://yor.wordpress.org/plugins/tags/sidebar/)[widget](https://yor.wordpress.org/plugins/tags/widget/)
 *  [Ìwòye Tó Péye](https://yor.wordpress.org/plugins/simple-hook-widget/advanced/)

## Àwọn ìbò

Kò tíì sí ohun táwọn èèyàn sọ nípa ẹ̀.

[Your review](https://wordpress.org/support/plugin/simple-hook-widget/reviews/#new-post)

[Wo gbogbo àwọn àgbéyẹ̀wò](https://wordpress.org/support/plugin/simple-hook-widget/reviews/)

## Àwọn Olùkópa

 *   [ Eddie Moya ](https://profiles.wordpress.org/eddiemoya/)

## Ìrànlọ́wọ́

Nǹkan wà tí o fẹ́ sọ? Ṣé o nílò ìrànlọ́wọ́?

 [Wo àpéjọ ìrànlọ́wọ́](https://wordpress.org/support/plugin/simple-hook-widget/)

## Ṣe ìtọrẹ

Ṣé o fẹ́ ṣe àtìlẹ́yìn fún ìlọsíwájú plugin yìí?

 [ Ṣe ìtọrẹ sí plugin yìí ](http://eddiemoya.com)