質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

Q&A

解決済

2回答

25649閲覧

wordpress twentyseventeen、frontpage.phpでの固定ページの表示について

r_tec

総合スコア25

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

0グッド

0クリップ

投稿2020/05/07 15:06

twenty seventeenのフロントページ(front-page.phpをインクルードしています)において、下にスクロールすると見れる固定ページのうち、1つだけデザインをいじりたいです。各固定ページにはid="panel数字"が割り振られています。今回は1番上に表示される固定ページ(id="panel1")のデザインを変更したいので、id="panel1"の時だけ読み込むテンプレートパーツを変えたいのですが、どうしたらよいでしょうか?
以下がfront-page.phpのコードです.

php

1<?php 2/** 3 * The front page template file 4 * 5 * If the user has selected a static page for their homepage, this is what will 6 * appear. 7 * Learn more: https://developer.wordpress.org/themes/basics/template-hierarchy/ 8 * 9 * @package WordPress 10 * @subpackage Twenty_Seventeen 11 * @since Twenty Seventeen 1.0 12 * @version 1.0 13 */ 14 15get_header(); ?> 16 17<div id="primary" class="content-area"> 18 <main id="main" class="site-main" role="main"> 19 20 <!-- <?php 21 // Show the selected front page content. 22 if ( have_posts() ) : 23 while ( have_posts() ) : 24 the_post(); 25 // get_template_part( 'template-parts/page/content', 'front-page' ); 26 get_template_part( 'template-parts/page/content', 'page-normal' ); 27 28 endwhile; 29 else : 30 get_template_part( 'template-parts/post/content', 'none' ); 31 endif; 32 ?> 33 34 <?php 35 // Get each of our panels and show the post data. 36 if ( 0 !== twentyseventeen_panel_count() || is_customize_preview() ) : // If we have pages to show. 37 38 /** 39 * Filter number of front page sections in Twenty Seventeen. 40 * 41 * @since Twenty Seventeen 1.0 42 * 43 * @param int $num_sections Number of front page sections. 44 */ 45 $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 ); 46 global $twentyseventeencounter; 47 48 // Create a setting and control for each of the sections available in the theme. 49 for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) { 50 $twentyseventeencounter = $i; 51 twentyseventeen_front_page_section( null, $i ); 52 } 53 54 endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here. 55 ?> 56 57 </main><!-- #main --> 58</div>#primary 59 60<?php 61get_footer(); 62

if ( 0 !== twentyseventeen_panel_count() || is_customize_preview() ) 以下が固定ページの表示に関わる場所だと思います。関数twentyseventeen_front_page_sectionですが、探しても見つかりません。
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

phpファイルで、id="panel1"の際に使用するテンプレートを別で用意し読み込みましたら解決しました。

投稿2020/05/09 09:58

r_tec

総合スコア25

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

自己解決

解決いたしました。ありがとうございます。

投稿2020/05/08 12:27

r_tec

総合スコア25

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kei344

2020/05/08 12:35

どのように解決したかを回答欄に追記いただけませんか?このページに辿り着いた同じ疑問を持つ人のために、ぜひお願いします。 【質問をした後に自己解決してしまった】 https://teratail.com/help#resolve-myself > また後から読む人のためにも、具体的な解決手順を記載してください。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問