Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* サイドバーを追加 [#hf4401a0]
** 概要 [#d3446471]
- index.php等の中でget_sidebar('foo')する。
- sidebar-foo.phpが読み込まれる。
- sidebar-foo.phpの中でdynamic_sidebar('bar')する。
- functions.phpの中でregister_sidebar(array('name' => 'ba...
- 管理画面のウィジェットでbarにウィジェットを追加する。
** テーマフォルダに入る [#n43dd7d1]
$ cd wp-content/themes/foo
** サイドバーファイルをコピーして追加し、内容を修正する [...
$ cp sidebar.php sidebar-2.php
$ vi sidebar-2.php
if ( ! is_active_sidebar( 'sidebar-2' ) ) {
return;
}
?>
<div id="secondary" class="widget-area" role="complement...
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div><!-- #secondary -->
** functions.phpを編集してregister_sidebar()を追加する [#...
$ vi functions.php
register_sidebar( array(
'name' => __( 'Sidebar-2', 'wp0803' ),
'id' => 'sidebar-2',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %...
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
) );
** WordPress管理画面のウィジェットカスタマイズで追加され...
(省略)
** テンプレートファイルを編集して追加したサイドバーを読み...
vi index.php
<?php get_sidebar(2); ?>
** 参考 [#c7fc4f89]
*** registe_sidebar() [#m774c894]
http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%...
*** is_active_sidebar() [#x360f423]
http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%...
*** get_sidebar() [#ga7a2b7c]
http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%...
*** dynamic_sidebar() [#g921b179]
http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%...
終了行:
* サイドバーを追加 [#hf4401a0]
** 概要 [#d3446471]
- index.php等の中でget_sidebar('foo')する。
- sidebar-foo.phpが読み込まれる。
- sidebar-foo.phpの中でdynamic_sidebar('bar')する。
- functions.phpの中でregister_sidebar(array('name' => 'ba...
- 管理画面のウィジェットでbarにウィジェットを追加する。
** テーマフォルダに入る [#n43dd7d1]
$ cd wp-content/themes/foo
** サイドバーファイルをコピーして追加し、内容を修正する [...
$ cp sidebar.php sidebar-2.php
$ vi sidebar-2.php
if ( ! is_active_sidebar( 'sidebar-2' ) ) {
return;
}
?>
<div id="secondary" class="widget-area" role="complement...
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</div><!-- #secondary -->
** functions.phpを編集してregister_sidebar()を追加する [#...
$ vi functions.php
register_sidebar( array(
'name' => __( 'Sidebar-2', 'wp0803' ),
'id' => 'sidebar-2',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %...
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
) );
** WordPress管理画面のウィジェットカスタマイズで追加され...
(省略)
** テンプレートファイルを編集して追加したサイドバーを読み...
vi index.php
<?php get_sidebar(2); ?>
** 参考 [#c7fc4f89]
*** registe_sidebar() [#m774c894]
http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%...
*** is_active_sidebar() [#x360f423]
http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%...
*** get_sidebar() [#ga7a2b7c]
http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%...
*** dynamic_sidebar() [#g921b179]
http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%...
ページ名: