wordpress3.5に関して質問です。テーマはtwentyelevenを想定しています。

トップページ、カテゴリーページ、記事投稿ページ等に
「投稿日時」
「カテゴリーアーカイブ」
「コメントをどうぞ」
「←古い投稿」
「←前へ」
「次へ→」
をカットする事を検討しています。

スクリーンショットを取りました。
対象サイトは
http://dca-labo.info/demo8/
スクリーンショットのurlは下記です。
http://dca-labo.info/demo8/testimg/sample2.jpg
http://dca-labo.info/demo8/testimg/sample3.jpg
http://dca-labo.info/demo8/testimg/sample4.jpg
http://dca-labo.info/demo8/testimg/sample5.jpg

どのテンプレートをどのように修正するもか判りません。
ご教授頂ければと思います。

回答の条件
  • URL必須
  • 1人5回まで
  • 登録:
  • 終了:2013/03/16 03:48:15
※ 有料アンケート・ポイント付き質問機能は2023年2月28日に終了しました。

ベストアンサー

id:rouge_2008 No.1

回答回数595ベストアンサー獲得回数351

ポイント200pt

・トップページ「index.php」
ページナビゲーション(※「← 古い投稿」「新しい投稿 →」)を削除するには、ループの前と後を編集します。

			<?php if ( have_posts() ) : ?>

				<?php twentyeleven_content_nav( 'nav-above' ); ?><!-- 上のページナビゲーションを削除する場合はここも削除します。 -->

				<?php /* Start the Loop */ ?>
				<?php while ( have_posts() ) : the_post(); ?>

					<?php get_template_part( 'content', get_post_format() ); ?>

				<?php endwhile; ?>

				<?php twentyeleven_content_nav( 'nav-below' ); ?><!-- 「← 古い投稿」「新しい投稿 →」を削除するにはここを削除します。 -->

			<?php else : ?>

・「functions.php」
「投稿日時:」を削除するには、576行目以降にある「twentyeleven_posted_on()」の処理(※始まってすぐのspan要素ごと)を編集します。

if ( ! function_exists( 'twentyeleven_posted_on' ) ) :
/**
 * Prints HTML with meta information for the current post-date/time and author.
 * Create your own twentyeleven_posted_on to override in a child theme
 *
 * @since Twenty Eleven 1.0
 */
function twentyeleven_posted_on() {
	printf( __( '<!-- ここのspan要素を削除またはコメントアウト <span class="sep">Posted on </span> --><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
		esc_url( get_permalink() ),
		esc_attr( get_the_time() ),
		esc_attr( get_the_date( 'c' ) ),
		esc_html( get_the_date() ),
		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
		esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
		get_the_author()
	);
}
endif;

・「content.php」
「コメントをどうぞ」を削除するには、75行目以降の次の箇所をそっくり削除します。

			<?php if ( comments_open() ) : ?>
			<?php if ( $show_sep ) : ?>
			<span class="sep"> | </span>
			<?php endif; // End if $show_sep ?>
			<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
			<?php endif; // End if comments_open() ?>

※以前a-kuma3さんが回答したように、「<?php if ( comments_open() ) : ?>」を「<?php if ( 0 ) : ?>」に変更して残して置いても大丈夫です。

・カテゴリーページ「category.php」
「カテゴリーアーカイブ: 」を削除するには、17行目以降の次の記述を

				<header class="page-header">
					<h1 class="page-title"><?php
						printf( __( 'Category Archives: %s', 'twentyeleven' ), '<span>' . single_cat_title( '', false ) . '</span>' );
					?></h1>

次のように変更します。

				<header class="page-header">
					<h1 class="page-title"><?php
						printf( '%s', '<span>' . single_cat_title( '', false ) . '</span>' );
					?></h1>

または次のように変更しても大丈夫です。

				<header class="page-header">
					<h1 class="page-title"><?php
						print( '<span>' . single_cat_title( '', false ) . '</span>' );
					?></h1>

ページナビゲーション(※「← 古い投稿」「新しい投稿 →」)を削除するには、上記のすぐ下29行目以降にあるループの前と後を編集します。

				<?php twentyeleven_content_nav( 'nav-above' ); ?><!-- 上のページナビゲーションを削除する場合はここも削除します。 -->

				<?php /* Start the Loop */ ?>
				<?php while ( have_posts() ) : the_post(); ?>

					<?php
						/* Include the Post-Format-specific template for the content.
						 * If you want to overload this in a child theme then include a file
						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
						 */
						get_template_part( 'content', get_post_format() );
					?>

				<?php endwhile; ?>

				<?php twentyeleven_content_nav( 'nav-below' ); ?><!-- 「← 古い投稿」「新しい投稿 →」を削除するにはここを削除します。 -->

・個別投稿ページ「single.php」
投稿ナビゲーション(※「← 前へ」「次へ →」)を削除するには、ループの処理が始まってすぐの所にある次の記述をそっくり削除します。

					<nav id="nav-single">
						<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
						<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span> Previous', 'twentyeleven' ) ); ?></span>
						<span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?></span>
					</nav><!-- #nav-single -->

※特に参考ページはありませんのでダミーのURLで失礼します。(http://q.hatena.ne.jp/)

id:mkusume

いつも丁寧なご回答誠にありがとうございます。確認します。

2013/03/15 11:59:17

コメントはまだありません

この質問への反応(ブックマークコメント)

「あの人に答えてほしい」「この質問はあの人が答えられそう」というときに、回答リクエストを送ってみてましょう。

これ以上回答リクエストを送信することはできません。制限について

回答リクエストを送信したユーザーはいません