wordpressを使って、HPを作っている最中です。
テーマはBizvektorで、拡張テーマにNEATを使っています。
OSはwindows。レンタルサーバーはロリポップです。
投稿した記事を1カラムにしたいのですが、どうやってサイドバーを消すのでしょうか?
リンク内容の様に「固定ページ」を1カラムにする方法は見つけたのですが、固定ページ以外で普通に投稿した記事も1カラムにしたいです。
リンク内容ページのやり方では、「single.php」の <?php get_sidebar(); ?> のコードは消すところまでは出来ました。その際、同じコードが見つからなかったので、一番近いであろう <?php get_sidebar(get_post_type()); ?> を消しました。
しかし「Step2 余白を調整」の「サイドバーを削除したphpの「main」の下に以下のコードを追記してください。」にて、single.phpにmainという記述が見つかりませんでしたので、立ち往生しています。
以下、テーマの編集(BizVektor: 単一記事の投稿 (single.php))からのコピーです。
<?php get_header(); ?> <!-- [ #container ] --> <div id="container" class="innerBox"> <!-- [ #content ] --> <div id="content" class="content"> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <!-- [ #post- ] --> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php if (is_biz_vektor_extra_single()) : ?><?php edit_post_link(__('Edit', 'biz-vektor'),'<div class="adminEdit"><span class="linkBtn linkBtnS linkBtnAdmin">','</span></div>'); ?> <?php do_action('biz_vektor_snsBtns'); ?> <?php /*-------------------------------------------*/ /* Related posts /*-------------------------------------------*/ if ( get_post_type() == 'post' ) : Global $biz_vektor_options; // Get now post's tag(terms) if (isset($biz_vektor_options['postRelatedCount']) && $biz_vektor_options['postRelatedCount'] ) { $terms = get_the_terms($post->ID,'post_tag'); $tag_count = count($terms); if ($terms) { $posts_count = mb_convert_kana($biz_vektor_options['postRelatedCount'], "a", "UTF-8"); // Set basic arrays $args = array( 'post-type' => 'post' ,'post__not_in' => array($post->ID), 'posts_per_page' => $posts_count ); // Set tag(term) arrays if ( $terms && $tag_count == 1 ) { foreach ( $terms as $key => $value) { $args['tag_id'] = $value->term_id ; } } else if ( $terms ) { foreach ( $terms as $key => $value) { $args['tag__in'][] = $value->term_id ; } } $tag_posts = get_posts($args); if ( $tag_posts ) { ?><?php biz_vektor_extra_single(); ?> <?php else: ?> <h1 class="entryPostTitle entry-title"><?php the_title(); ?><?php edit_post_link(__('Edit', 'biz-vektor'), ' <span class="edit-link edit-item">[ ', ' ]' ); ?></h1> <?php get_template_part('module_entry_meta');?> <div class="entry-content post-content"> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-link">' . 'Pages:', 'after' => '</div>' ) ); ?> <div class="entry-utility"> <?php $tags_list = get_the_tag_list( '', ', ' ); if ( $tags_list ): ?> <dl class="tag-links"> <?php printf( __('<dt>Tags</dt><dd>%1$s</dd>', 'biz-vektor'), $tags_list ); ?> </dl> <?php endif; ?> </div> <!-- .entry-utility --> </div><!-- .entry-content -->
<?php } // if ( $tag_posts ) } // if ( $terms ) } // if ( $biz_vektor_options['postRelatedCount'] ) { endif; wp_reset_postdata(); /*-------------------------------------------*/ /* ad_related_after /*-------------------------------------------*/ if ( get_post_type() == 'post' ) : Global $biz_vektor_options; if (isset($biz_vektor_options['ad_related_after']) && $biz_vektor_options['ad_related_after']) { echo '<div class="sectionBox">'.apply_filters('widget_text',$biz_vektor_options['ad_related_after']).'</div>'; } endif; ?> <div id="nav-below" class="navigation"> <div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">←</span> %title' ); ?></div> <div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">→</span>' ); ?></div> </div><!-- #nav-below --> <?php endif; ?> </div> <!-- [ /#post- ] --> <?php do_action('biz_vektor_fbComments'); ?> <?php comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?> <?php do_action('biz_vektor_fbLikeBoxDisplay'); ?> </div> <!-- [ /#content ] --> <!-- [ #sideTower ] --> <div id="sideTower" class="sideTower"> <?php get_sidebar(get_post_type()); ?> </div> <!-- [ /#sideTower ] --> <?php biz_vektor_sideTower_after();?> </div> <!-- [ /#container ] --> <?php get_footer(); ?><!-- [ .subPostListSection ] --> <div class="subPostListSection"> <h3>関連記事</h3> <ul class="child_outer"> <?php foreach ($tag_posts as $key => $post) { ?> <li class="ttBox"> <div class="entryTxtBox<?php if ( has_post_thumbnail()) echo ' ttBoxTxt ttBoxRight haveThumbnail'; ?>"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </div><!-- [ /.entryTxtBox ] --> <?php if ( has_post_thumbnail()) { ?> <div class="ttBoxThumb ttBoxLeft"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></div> <?php } ?> </li> <?php } // foreach ?> </ul><!-- [ /.child_outer ] --> </div><!-- [ /.subPostListSection ] -->
以上となります。
※<?php get_sidebar(get_post_type()); ?>の記述は、戻してあります。
投稿記事のサイドバーの消し方が分かる方、何卒アドバイスをお願いします。
もしBizvektorの機能でサイドバーを消せるのであれば、そちらも教えて頂けると幸いです。
よろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/01/19 23:08
退会済みユーザー
2016/01/19 23:16
退会済みユーザー
2016/01/20 03:30 編集
退会済みユーザー
2016/01/22 07:18
退会済みユーザー
2016/01/22 10:45