「TCD AWARD 2023」受賞サイトを発表しました。

ワードプレステーマ別

TCDテーマSTORY:NEWSやブログ一覧の位置を変更する方法

Q.STORYのトップページにてNEWSとブログ一覧部分の箇所を変更したい

STORYのトップページにてnews一覧とブログ一覧のセクションをTOPスライダー下に移動させたいですが方法はありますか。

A.該当ファイルを編集してください

編集するファイル:front-page.php

front-page.phpの164行目<div class=”inner”>から310行目</div>までをカットし、32行目<div id=”content01″ class=”main”>の次にペーストしてください。

下記の部分がカット部分です。

	<div class="inner">
<?php
if ( $show_index_news_content ) :
?>
		<section class="fade01">
<?php
	if ( is_mobile() && ! is_no_responsive() ) :
?>
			<h2 class="headline-primary headline-font-type"><?php echo esc_html( $options['index_news_headline'] ); ?></h2>
<?php
	else :
?>
			<h2 class="headline-primary headline-font-type" style="font-size: <?php echo esc_attr( $index_news_headline_font_size ); ?>px;"><?php echo esc_html( $options['index_news_headline'] ); ?></h2>
<?php
	endif;
?>
<?php
	if ( $news_query->have_posts() ) :
?>
			<div class="top-news flex flex-wrap">
<?php
		while ( $news_query->have_posts() ) :
			$news_query->the_post();
?>
				<article class="article02">
   					<a class="article02-thumbnail <?php echo esc_attr( $hover_type ); ?>" href="<?php the_permalink(); ?>">
<?php
			if ( has_post_thumbnail() ) :
				the_post_thumbnail( 'size1' );
			else :
?>
						<img src="<?php echo get_template_directory_uri(); ?>/img/common/no-image-280x280.gif" alt="<?php the_title(); ?>">
<?php
			endif;
?>
					</a>
    				<div class="article02-content">
<?php
			if ( $options['show_date_news'] ) :
?>
     					<time class="article02-date" datetime="<?php the_time( 'Y-m-d' ); ?>"><?php the_time( 'Y.m.d' ); ?></time>
<?php
			endif;
?>
      					<h3 class="article02-title">
							<a href="<?php the_permalink(); ?>"><?php echo wp_trim_words( get_the_title(), 40, '...' ); ?></a>
						</h3>
<?php
			if ( ! is_mobile() ) :
?>
      					<p class="article02-text"><?php the_excerpt(); ?></p>
<?php
			endif;
?>
   					</div>
				</article>
<?php
		endwhile;
		wp_reset_postdata();
?>
			</div>
<?php
	endif;
	if ( $options['show_index_news_button'] ) :
?>
			<p class="button"><a href="<?php echo get_post_type_archive_link( 'news' ); ?>"><?php echo esc_html( $options['index_news_button'] ); ?></a></p>
		</section>
<?php
	endif;
endif;
if ( $options['show_index_blog_content'] ) :
?>
		<section class="fade01">
<?php
	if ( is_mobile() && ! is_no_responsive() ) :
?>
			<h2 class="headline-primary headline-font-type"><?php echo esc_html( $options['index_blog_headline'] ); ?></h2>
<?php
	else :
?>
			<h2 class="headline-primary headline-font-type" style="font-size: <?php echo esc_attr( $index_blog_headline_font_size ); ?>px;"><?php echo esc_html( $options['index_blog_headline'] ); ?></h2>
<?php
	endif;
?>
<?php
	if ( $blog_query->have_posts() ) :
?>
			<div class="top-blog flex flex-wrap">
<?php
	while ( $blog_query->have_posts() ) :
		$blog_query->the_post();
		if ( $archive_show_category ) {
			$categories = get_the_category();
			$thelist = '';
			$i = 0;
			foreach ( $categories as $category ) {
				if ( $i > 0 ) {
					$thelist .= ', ';
				}
				$thelist .= '<span class="article03-category-item" data-url="' . esc_url( get_category_link( $category->term_id ) ) . '">' . esc_html( $category->name ) . '</span>';
				$i++;
			}
		}
?>
				<article class="article03">
					<a class="flex flex-column" href="<?php the_permalink(); ?>">
						<div class="article03-thumbnail <?php echo esc_attr( $hover_type ); ?>">
<?php
		if ( has_post_thumbnail() ) :
			the_post_thumbnail( 'size1' );
		else :
?>
							<img src="<?php echo get_template_directory_uri(); ?>/img/common/no-image-280x280.gif" alt="<?php the_title(); ?>">
<?php
		endif;
?>
						</div>
						<div class="article03-content flex flex-auto flex-column">
							<h2 class="article03-title headline-font-type"><?php echo is_mobile() ? wp_trim_words( get_the_title(), 20, '...' ) : wp_trim_words( get_the_title(), 25, '...' ); ?></h2>
<?php
		if ( $archive_show_date || $archive_show_category ) :
?>
							<p class="article03-meta">
								<?php if ( $archive_show_date ) : ?><time class="article03-date" datetime="<?php the_time( 'Y-m-d' ); ?>"><?php the_time( 'Y.m.d' ); ?></time><?php endif; ?><?php if ( ! wp_is_mobile() && $archive_show_category ) : ?><span class="article03-category"><?php echo $thelist; ?></span><?php endif; ?>
							</p>
<?php
		endif;
?>
						</div>
					</a>
				</article>
<?php
	endwhile;
	wp_reset_postdata();
?>
			</div>
<?php
	endif;
	if ( $options['show_index_blog_button'] ) :
?>
			<p class="button"><a href="<?php echo get_post_type_archive_link( 'post' ); ?>"><?php echo esc_html( $options['index_blog_button'] ); ?></a></p>
		</section>
<?php
	endif;
endif;
?>
	</div>

設定は、以上となります。
なお、NEWSのみ、ブログのみという変更は大幅な仕様変更となりますので有償対応となります。

この記事は役に立ちましたか?

もし参考になりましたら、下のボタンで教えてください。
今後の記事作成の参考とさせて頂きます!

同じテーマのカスタマイズ記事