• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

「関数リファレンス/register sidebar widget」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(en:Function Reference/register_sidebar_widget 23:55, 3 July 2009 Ramiy 版を翻訳用にコピー)
 
(整形・リンク調整/未翻訳)
3行目: 3行目:
 
Register widget for sidebar with backwards compatibility.
 
Register widget for sidebar with backwards compatibility.
  
Provides backwards compatability to [[Function_Reference/wp_register_sidebar_widget|wp_register_sidebar_widget()]]. Registers callback as a widget output function with unique index name. This causes a draggable object containing name to appear in the admin interface.  
+
Provides backwards compatability to [[関数リファレンス/wp_register_sidebar_widget|wp_register_sidebar_widget()]]/[[:en:Function Reference/wp_register_sidebar_widget|en]]. Registers callback as a widget output function with unique index name. This causes a draggable object containing name to appear in the admin interface.  
 
      
 
      
 
A basic widget is simply a function that prints some HTML. To get a widget included in the widgets palette, you must register it via this function.
 
A basic widget is simply a function that prints some HTML. To get a widget included in the widgets palette, you must register it via this function.
17行目: 17行目:
 
== Usage ==
 
== Usage ==
  
%%% <?php register_sidebar_widget( $name, $output_callback, $classname ); ?> %%%
+
<?php register_sidebar_widget( $name, $output_callback, $classname ); ?>
  
 
== Parameters ==
 
== Parameters ==
63行目: 63行目:
 
{{Tag Footer}}
 
{{Tag Footer}}
  
[[Category:Functions]]
+
{{DEFAULTSORT:Register_sidebar_widget}}
[[Category:Widgets]]
+
[[Category:ウィジェット]]
 +
[[Category:wp2.2]]
  
 
[[en:Function Reference/register_sidebar_widget]]
 
[[en:Function Reference/register_sidebar_widget]]

2010年3月3日 (水) 22:24時点における版

Description

Register widget for sidebar with backwards compatibility.

Provides backwards compatability to wp_register_sidebar_widget()/en. Registers callback as a widget output function with unique index name. This causes a draggable object containing name to appear in the admin interface.

A basic widget is simply a function that prints some HTML. To get a widget included in the widgets palette, you must register it via this function.

It is possible for theme authors to define replacement widgets within functions.php. Replace an existing widget by registering its name with a new callback. An empty callback will unregister a widget.

Because each widget has a unique name and a non-unique callback, the default markup before a widget looks like this:

<li id="{name}" class="{callback}">{callback output}</li>

When you register a widget you may pass a custom HTML class to replace callback. This is most useful for object-oriented widgets whose callbacks are passed as arrays.

Usage

<?php register_sidebar_widget( $name, $output_callback, $classname ); ?>

Parameters

$name
string/int) (必須) Widget ID.
初期値: なし
$output_callback
callback) (必須) Run when widget is called.
初期値: なし
$classname
string) (optional) Classname widget.
初期値: なし

Example

<?php
function my_widget {
    // print some HTML for the widget to display here.
}

register_sidebar_widget("my_widget", "my_widget");
?>

Given a class my_widget whose method that prints the widget HTML is called display, you would use the following code:

<?php
class my_widget {
    function display() {
        // print some HTML for the widget to display here.
    }
}

register_sidebar_widget('My Widget', array('my_widget', 'display')); // callback is mywidget::display
?>

Change Log

Since: 2.2.0

Source File

register_sidebar_widget() is located in wp-includes/widgets.php.

最新英語版: WordPress Codex » Function Reference/register_sidebar_widget最新版との差分

Related

ウィジェット API: is_active_widget(), the_widget(), register_widget(), unregister_widget() / en, wp_register_widget_control() / en, wp_unregister_widget_control() / en, wp_convert_widget_settings() / en, wp_get_widget_defaults() / en, wp_widget_description() / en



関数リファレンステンプレートタグ目次もご覧ください。