Title: Mathesonでブログに右カラムにサイドバーを表示させたい
Last modified: 2016年11月6日

---

# Mathesonでブログに右カラムにサイドバーを表示させたい

 *  [hiroi3147](https://ja.wordpress.org/support/users/hiroi3147/)
 * (@hiroi3147)
 * [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/matheson%e3%81%a7%e3%83%96%e3%83%ad%e3%82%b0%e3%81%ab%e5%8f%b3%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ab%e3%82%b5%e3%82%a4%e3%83%89%e3%83%90%e3%83%bc%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f/)
 * Mathesonというテーマを使ったサイトの修正を知人に依頼されました。
    [https://ja.wordpress.org/themes/matheson/](https://ja.wordpress.org/themes/matheson/)
   ブログの右カラムにメニューを入れたいという依頼なのですが、このテーマは基本ブログ
   はサイドバーがサイトの右や左に表示するということはないようで、ブログ記事が横幅
   100%に表示されるようです。いろいろ探ってみましたが、どこを直せばいいものかわから
   ず困っています。
 * どなたかご存知の方がいらっしゃいましたら、ご教示いただければと思います。

6件の返信を表示中 - 1 - 6件目 (全6件中)

 *  [천궁 메텔](https://ja.wordpress.org/support/users/digitmaetel/)
 * (@digitmaetel)
 * [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/matheson%e3%81%a7%e3%83%96%e3%83%ad%e3%82%b0%e3%81%ab%e5%8f%b3%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ab%e3%82%b5%e3%82%a4%e3%83%89%e3%83%90%e3%83%bc%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f/#post-181646)
 * **ブログ一覧にサイドバーがほしいということですね。**
    「**archive.php にサイド
   バーを追加**」するか、 「**固定ページにはサイドバーがあるので、ブログ記事を取得
   してリスト**」すればどうですか。
 *  [gblsm](https://ja.wordpress.org/support/users/gblsm/)
 * (@gblsm)
 * [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/matheson%e3%81%a7%e3%83%96%e3%83%ad%e3%82%b0%e3%81%ab%e5%8f%b3%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ab%e3%82%b5%e3%82%a4%e3%83%89%e3%83%90%e3%83%bc%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f/#post-181647)
 * 別案です。検証していないのと、ちょっと強引ですが・・・（個別投稿/single.phpと
   ふつうの固定ページ/page.phpはサイドバーが表示されますよね。）
    - ブログ投稿一覧を表示するコードを固定ページテンプレートへ書いて、固定フロント
      ページでその固定ページを「フロントページ」に指定。front-page.phpはサイドバー
      を表示してくれます。
    - 固定フロントページの「投稿ページ」を使う場合はhome.phpを新しく作る（いまは
      index.phpが使われるのでサイドバーがつきません）。home.phpの中身はindex.php
      を複製してサイドバー表示用コードを追加する。サイドバーのコードはsingle.php
      が参考になります。
 *  トピック投稿者 [hiroi3147](https://ja.wordpress.org/support/users/hiroi3147/)
 * (@hiroi3147)
 * [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/matheson%e3%81%a7%e3%83%96%e3%83%ad%e3%82%b0%e3%81%ab%e5%8f%b3%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ab%e3%82%b5%e3%82%a4%e3%83%89%e3%83%90%e3%83%bc%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f/#post-181748)
 * お返事おそくなりすみません。
    時間がなくて次の作業が止まってしまっています。
 * 맹조さま
    archive.phpにサイドバーを追加すると一番下に行事されてしまうので、考え
   てしまっていました。ブログ記事を取得してリストとはgblsmと同じはなしになります
   か？
 * gblsmさま
    この方法でいけそうですね。やってみます。
 *  [gblsm](https://ja.wordpress.org/support/users/gblsm/)
 * (@gblsm)
 * [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/matheson%e3%81%a7%e3%83%96%e3%83%ad%e3%82%b0%e3%81%ab%e5%8f%b3%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ab%e3%82%b5%e3%82%a4%e3%83%89%e3%83%90%e3%83%bc%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f/#post-181783)
 * 一箇所訂正させてください。一番目のほう（固定ページテンプレートを書いて・・・）
   はうまくいかなさそうです。二番目（home.phpを使う）が良いと思います。
 *  モデレーター [まーちゅう](https://ja.wordpress.org/support/users/rocketmartue/)
 * (@rocketmartue)
 * [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/matheson%e3%81%a7%e3%83%96%e3%83%ad%e3%82%b0%e3%81%ab%e5%8f%b3%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ab%e3%82%b5%e3%82%a4%e3%83%89%e3%83%90%e3%83%bc%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f/#post-181797)
 * テーマのCSSでBootstrapを使ってますので、
 *     ```
       <div class="container">
       <div class="row">
       <div class="col-sm-12">
       ```
   
 * この辺りのCSSを理解していないと、難しいかもしれません。
 * [http://getbootstrap.com/css/#grid](http://getbootstrap.com/css/#grid)
    [http://bootstrap3.cyberlab.info/css/gridSystem.html](http://bootstrap3.cyberlab.info/css/gridSystem.html)
 *  [nobita](https://ja.wordpress.org/support/users/nobita/)
 * (@nobita)
 * [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/matheson%e3%81%a7%e3%83%96%e3%83%ad%e3%82%b0%e3%81%ab%e5%8f%b3%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ab%e3%82%b5%e3%82%a4%e3%83%89%e3%83%90%e3%83%bc%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f/#post-181800)
 * こんにちは
 * 固定ページタイトル　home　と　blog　を作成
 * 固定ページテンプレートを設定、フロントページに home
 * ポストページに、blog　を指定
 * index.phpを以下に変更
 * で、トップページ、ブログアーカイブ2カラムになると思います。
 * ブログアーカイブで、カラム落ちするのは、ブログアーカイブページで、is_singular()
   がtrue になってしまっているせいなんじゃないかと思います、多分。
 *     ```
       <?php
       /**
        * The main template file.
        *
        * This is the most generic template file in a WordPress theme
        * and one of the two required files for a theme (the other being style.css).
        * It is used to display a page when nothing more specific matches a query.
        * For example, it puts together the home page when no home.php file exists.
        *
        * Learn more: http://codex.wordpress.org/Template_Hierarchy
        *
        * @since 1.0.0
        */
       if( true == is_home() && false == is_front_page() ) {//ブログページの設定
   
       //bavotasan_primary_attr のコピー
   
       function custom_bavotasan_primary_attr() {
       	$bavotasan_theme_options = bavotasan_theme_options();
       	$primary = str_replace( 'col-md-', '', $bavotasan_theme_options['primary'] );
       	$secondary = ( is_active_sidebar( 'second-sidebar' ) ) ? str_replace( 'col-md-', '', $bavotasan_theme_options['secondary'] ) : 12 - $primary;
       	$tertiary = 12 - $primary - $secondary;
       	$class = $bavotasan_theme_options['primary'];
       	if( true !== is_home() && false !== is_front_page() ) {// ブログアーカイブ出なかったらの条件を追加
       		$class = ( is_singular() || is_404() ||( function_exists( 'is_bbpress' ) && is_bbpress() ) ) ? $class : 'col-sm-12';
       	}
       	$push = '';
       	$class = ( 'left' == $bavotasan_theme_options['layout'] ) ? $class . ' pull-right' : $class;
   
       	echo 'class="' . esc_attr( $class ) . esc_attr( $push ) . '"';
       }
   
       //page.phpのコピー
       get_header();
       ?>
   
       	<div class="container">
       		<div class="row">
       			<div id="primary" <?php custom_bavotasan_primary_attr(); ?>>
       				<?php
       				while ( have_posts() ) : the_post();
       					?>
       					<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       							<h1 class="entry-title"><?php the_title(); ?></h1>
   
       						    <div class="entry-content">
       							    <?php the_content( __( 'Read more', 'matheson') ); ?>
       						    </div><!-- .entry-content -->
   
       						    <?php get_template_part( 'content', 'footer' ); ?>
       					</article><!-- #post-<?php the_ID(); ?> -->
   
       					<?php
       					comments_template( '', true );
       				endwhile;
       				?>
       			</div>
       			<?php get_sidebar(); ?>
       		</div>
       	</div>
   
       <?php get_footer(); 
   
       }else{
       //元のindex.php
       get_header(); ?>
   
       	<div id="primary" <?php bavotasan_primary_attr(); ?>>
       		<?php
       		if ( have_posts() ) :
       			while ( have_posts() ) : the_post();
       				get_template_part( 'content', get_post_format() );
       			endwhile;
   
       			bavotasan_pagination();
       		else :
       			get_template_part( 'content', 'none' );
       		endif;
       		?>
       	</div>
   
       <?php
       get_footer();
       	}
       ?>
       ```
   

6件の返信を表示中 - 1 - 6件目 (全6件中)

 トピック「Mathesonでブログに右カラムにサイドバーを表示させたい」には新たに返信する
ことはできません。

## タグ

 * [Matheson](https://ja.wordpress.org/support/topic-tag/matheson/)
 * [sidebar](https://ja.wordpress.org/support/topic-tag/sidebar/)

 * フォーラム: [テーマ](https://ja.wordpress.org/support/forum/themes/)
 * 6件の返信
 * 5人の参加者
 * 最後の返信者: [nobita](https://ja.wordpress.org/support/users/nobita/)
 * 最後の活動: [10年、 6ヶ月前](https://ja.wordpress.org/support/topic/matheson%e3%81%a7%e3%83%96%e3%83%ad%e3%82%b0%e3%81%ab%e5%8f%b3%e3%82%ab%e3%83%a9%e3%83%a0%e3%81%ab%e3%82%b5%e3%82%a4%e3%83%89%e3%83%90%e3%83%bc%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%95%e3%81%9b%e3%81%9f/#post-181800)
 * 状態: 未解決

## トピック

### 人気のトピック

### 返信がないトピック

### サポート関連ではないトピック

### 解決済みのトピック

### 未解決のトピック

### すべてのトピック
