Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Creates widgets for wp_head, wp_footer, admin_head and admin_footer.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 assets
Octocat-spinner-32 languages
Octocat-spinner-32 changelog.md
Octocat-spinner-32 class.Unfiltered_Text_Widget.php
Octocat-spinner-32 readme.md
Octocat-spinner-32 readme.txt
Octocat-spinner-32 toschos-magic-widgets.php
readme.md

Magic Widgets

A WordPress plugin that assigns widgets to action hooks.

It defines sidebar areas in wp_head, wp_footer, admin_head and admin_footer. You can change the list, add your own areas or remove the default areas.

Additionally, the plugin creates a new widget, called Unfiltered Text. It is very similar to the regular Text widget, but it doesn’t insert any extra markup.

If you want to help: we need more translations.

Hooks

There is one hook in the main plugin class:

$actions = array (
    'wp_head'       => __( 'Front End Header', 'plugin_magic_widgets' ),
    'wp_footer'     => __( 'Front End Footer', 'plugin_magic_widgets' ),
    'admin_head'    => __( 'Back End Header', 'plugin_magic_widgets' ),
    'admin_footer'  => __( 'Back End Footer', 'plugin_magic_widgets' )
);

$actions = apply_filters( 'magic_widgets_actions', $actions );

You can add your own sidebar areas here.

The widget class Unfiltered_Text_Widget offers more hooks:

apply_filters( 'tmw_visibility_options', $options )

$options is a list of visibility selections:

$options = array (
    'all'       => __( 'All', 'plugin_magic_widgets' ),
    'members'   => __( 'Members only', 'plugin_magic_widgets' ),
    'anonymous' => __( 'Anonymous visitors only', 'plugin_magic_widgets' )
);

You can add new options for particular roles, languages, visitors with comment cookies … be creative.

Then you have to hook into the output handler:

do_action( 'tmw_show_widget', $instance, $args );

$instance['visibility'] will tell you what visibility the user has selected. This action fires for custom visibility selections only.

There are two other output actions with the same arguments:

do_action( 'tmw_before_show_widget', $instance, $args );
do_action( 'tmw_after_show_widget', $instance, $args );

Both run on every output, no matter what the visibility is.

Beschreibung auf Deutsch

Something went wrong with that request. Please try again.