質問編集履歴
3
コードを追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -63,4 +63,36 @@
|
|
63
63
|
```
|
64
64
|
|
65
65
|
また、少し進捗があり、page.phpの頭でget_header()によりheader.phpを呼び出していたので、それを消しました。次に、以下のコードの内容のpage-header.phpというファイルを作り、page.phpの先頭でget_template_part('template_parts/header/page','header');としたのですが、固定ページにヘッダーは読み込まれず、ページのレイアウトも崩れてしまいました。
|
66
|
-
そこで、include()をつかって同じファイルを呼び出してみたのですが、結果は変わらずといった状況です。
|
66
|
+
そこで、include()をつかって同じファイルを呼び出してみたのですが、結果は変わらずといった状況です。
|
67
|
+
|
68
|
+
```php
|
69
|
+
<?php
|
70
|
+
/**
|
71
|
+
*
|
72
|
+
*
|
73
|
+
* This is the template that displays all of the <head> section and everything up until <div id="content">
|
74
|
+
*
|
75
|
+
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
|
76
|
+
*
|
77
|
+
* @package WordPress
|
78
|
+
* @subpackage Twenty_Seventeen
|
79
|
+
* @since Twenty Seventeen 1.0
|
80
|
+
* @version 1.0
|
81
|
+
*/
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<header id="masthead" class="site-header" role="banner">
|
87
|
+
|
88
|
+
|
89
|
+
<?php if ( has_nav_menu( 'top' ) ) : ?>
|
90
|
+
<div class="navigation-top">
|
91
|
+
<div class="wrap">
|
92
|
+
<?php get_template_part( 'template-parts/navigation/navigation', 'top' ); ?>
|
93
|
+
</div><!-- .wrap -->
|
94
|
+
</div><!-- .navigation-top -->
|
95
|
+
<?php endif; ?>
|
96
|
+
|
97
|
+
</header><!-- #masthead -->
|
98
|
+
```
|
2
進捗があったので追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
twentyseveneenのテーマなんですが、ヘッダーのメニューをクリックして、各固定ページなどに飛んだ時に、上に表示されるヘッダー画像とサイトタイトルを非表示にし、ヘッダーメニューのみが表示されるようにしたいです。どうしたらよいでしょうか?
|
2
|
-
以下、header.phpの
|
2
|
+
以下、header.phpのコードになります。
|
3
3
|
```php
|
4
4
|
<?php
|
5
5
|
/**
|
@@ -60,4 +60,7 @@
|
|
60
60
|
<div class="site-content-contain">
|
61
61
|
<div id="content" class="site-content">
|
62
62
|
|
63
|
-
```
|
63
|
+
```
|
64
|
+
|
65
|
+
また、少し進捗があり、page.phpの頭でget_header()によりheader.phpを呼び出していたので、それを消しました。次に、以下のコードの内容のpage-header.phpというファイルを作り、page.phpの先頭でget_template_part('template_parts/header/page','header');としたのですが、固定ページにヘッダーは読み込まれず、ページのレイアウトも崩れてしまいました。
|
66
|
+
そこで、include()をつかって同じファイルを呼び出してみたのですが、結果は変わらずといった状況です。
|
1
header.phpのコードを追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,1 +1,63 @@
|
|
1
|
-
twentyseveneenのテーマなんですが、ヘッダーのメニューをクリックして、各固定ページなどに飛んだ時に、上に表示されるヘッダー画像とサイトタイトルを非表示にし、ヘッダーメニューのみが表示されるようにしたいです。どうしたらよいでしょうか?
|
1
|
+
twentyseveneenのテーマなんですが、ヘッダーのメニューをクリックして、各固定ページなどに飛んだ時に、上に表示されるヘッダー画像とサイトタイトルを非表示にし、ヘッダーメニューのみが表示されるようにしたいです。どうしたらよいでしょうか?
|
2
|
+
以下、header.phpのこーどになります。
|
3
|
+
```php
|
4
|
+
<?php
|
5
|
+
/**
|
6
|
+
* The header for our theme
|
7
|
+
*
|
8
|
+
* This is the template that displays all of the <head> section and everything up until <div id="content">
|
9
|
+
*
|
10
|
+
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
|
11
|
+
*
|
12
|
+
* @package WordPress
|
13
|
+
* @subpackage Twenty_Seventeen
|
14
|
+
* @since Twenty Seventeen 1.0
|
15
|
+
* @version 1.0
|
16
|
+
*/
|
17
|
+
|
18
|
+
?><!DOCTYPE html>
|
19
|
+
<html <?php language_attributes(); ?> class="no-js no-svg">
|
20
|
+
<head>
|
21
|
+
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
22
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
23
|
+
<link rel="profile" href="http://gmpg.org/xfn/11">
|
24
|
+
|
25
|
+
<?php wp_head(); ?>
|
26
|
+
</head>
|
27
|
+
|
28
|
+
<body <?php body_class(); ?>>
|
29
|
+
<?php wp_body_open(); ?>
|
30
|
+
<div id="page" class="site">
|
31
|
+
<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentyseventeen' ); ?></a>
|
32
|
+
|
33
|
+
<header id="masthead" class="site-header" role="banner">
|
34
|
+
|
35
|
+
<?php get_template_part( 'template-parts/header/header', 'image' ); ?>
|
36
|
+
|
37
|
+
<?php if ( has_nav_menu( 'top' ) ) : ?>
|
38
|
+
<div class="navigation-top">
|
39
|
+
<div class="wrap">
|
40
|
+
<?php get_template_part( 'template-parts/navigation/navigation', 'top' ); ?>
|
41
|
+
</div><!-- .wrap -->
|
42
|
+
</div><!-- .navigation-top -->
|
43
|
+
<?php endif; ?>
|
44
|
+
|
45
|
+
</header><!-- #masthead -->
|
46
|
+
|
47
|
+
<?php
|
48
|
+
|
49
|
+
/*
|
50
|
+
* If a regular post or page, and not the front page, show the featured image.
|
51
|
+
* Using get_queried_object_id() here since the $post global may not be set before a call to the_post().
|
52
|
+
*/
|
53
|
+
if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) :
|
54
|
+
echo '<div class="single-featured-image-header">';
|
55
|
+
echo get_the_post_thumbnail( get_queried_object_id(), 'twentyseventeen-featured-image' );
|
56
|
+
echo '</div><!-- .single-featured-image-header -->';
|
57
|
+
endif;
|
58
|
+
?>
|
59
|
+
|
60
|
+
<div class="site-content-contain">
|
61
|
+
<div id="content" class="site-content">
|
62
|
+
|
63
|
+
```
|