トップページのみサイドバーの内容を変更する方法
19:16 pm
具体的に言うと3番目のサイドバーセット(サイドバー3)を表示させる方法です。
3つ以上のサイドバーセットを登録する方法は、以前に投稿しましたが、そこで作ったサイドバー3を今回、トップページの左側のサイドバーに使ってみます。
1.sidebar-left.php を編集してsidebar-top_page.php として保存
dynamic_sidebar(1) を dynamic_sidebar(3) に修正します。
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?>2.top_page.phpを修正します。
sidebar-left.php を sidebar-top_page.php に修正します。
<?php
$current_page = $post->ID; // Hack to prevent the no sidebar error
include_once("sidebar-top_page.php");
$post->ID = $current_page;
?>この方法を応用すれば、ページ毎にサイドバーの内容を変更することができます。
Related Posts
No Comments »
RSS feed for comments on this post. TrackBack URL
Leave a comment
You must be logged in to post a comment.