質問編集履歴
4
header.phpの記述を追記しました
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
WordPressにて、スライダー
|
1
|
+
WordPressにて、ヘッダーに記事スライダーを実装した後、記事リンク先が正常に機能しておらずに困っています。
|
test
CHANGED
@@ -14,33 +14,105 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
恐らく以下のコードが影響しているものだと考えています。
|
17
|
+
恐らく以下のヘッダーに記事スライダー実装する際に記述したコードが影響しているものだと考えています。
|
18
|
-
|
19
|
-
|
18
|
+
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
|
24
|
-
|
25
|
-
|
20
|
+
|
26
|
-
|
27
|
-
技術不足でよくわからずにいます。
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
どなたかよろしくおねがいします。
|
21
|
+
どなたかご教授よろしくおねがいします。
|
32
22
|
|
33
23
|
|
34
24
|
|
35
25
|
### 該当のソースコード
|
36
26
|
|
37
|
-
ヘッダーに記事スライダーを設置するために書いたコード
|
27
|
+
ヘッダーに記事スライダーを設置するために書いたコード
|
28
|
+
|
38
|
-
|
29
|
+
「header.php」に記載しています。自分で追記した箇所は<div class="your-class">~</div>の箇所になります。
|
30
|
+
|
39
|
-
|
31
|
+
文字数制限の関係で、途中から途中までの記載になります。
|
32
|
+
|
33
|
+
|
40
34
|
|
41
35
|
```ここに言語を入力
|
42
36
|
|
37
|
+
<div id="container">
|
38
|
+
|
39
|
+
<!-- header -->
|
40
|
+
|
41
|
+
<?php if(!is_singular('lp') && !is_attachment() ): ?>
|
42
|
+
|
43
|
+
<!-- lpページでは表示しない -->
|
44
|
+
|
45
|
+
<div id="header" class="clearfix">
|
46
|
+
|
47
|
+
<?php $firstView_pos = get_option('diver_option_firstview_position',get_theme_mod('headerimage_position','bottom')); ?>
|
48
|
+
|
49
|
+
<?php if($firstView_pos == 'top'){get_template_part('/lib/parts/firstview');} ?>
|
50
|
+
|
51
|
+
<header class="header-wrap" role="banner" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
|
52
|
+
|
53
|
+
<?php get_template_part('/lib/parts/miniheader'); ?>
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<div class="header-logo clearfix">
|
58
|
+
|
59
|
+
<?php get_template_part('/lib/parts/sp','menu'); ?>
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!-- /Navigation -->
|
64
|
+
|
65
|
+
<div id="logo">
|
66
|
+
|
67
|
+
<?php $diverlogo = get_theme_mod("diver_logo"); ?>
|
68
|
+
|
69
|
+
<a href="<?php echo home_url('/'); ?>">
|
70
|
+
|
71
|
+
<?php if(empty($diverlogo)): ?>
|
72
|
+
|
73
|
+
<div class="logo_title"><?php bloginfo('name'); ?></div>
|
74
|
+
|
75
|
+
<?php else: ?>
|
76
|
+
|
77
|
+
<img src="<?php echo esc_url($diverlogo) ?>" alt="<?php bloginfo('name'); ?>">
|
78
|
+
|
79
|
+
<?php endif; ?>
|
80
|
+
|
81
|
+
</a>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<?php if(get_theme_mod('nav_style','in')=='in'): ?>
|
86
|
+
|
87
|
+
<nav id="nav" role="navigation" itemscope="itemscope" itemtype="http://scheme.org/SiteNavigationElement">
|
88
|
+
|
89
|
+
<?php wp_nav_menu( array (
|
90
|
+
|
91
|
+
'theme_location' => 'header-navi',
|
92
|
+
|
93
|
+
'items_wrap' => '<ul id="mainnavul" class="menu">%3$s</ul>',
|
94
|
+
|
95
|
+
'link_before' => '',
|
96
|
+
|
97
|
+
'link_after' => '',
|
98
|
+
|
99
|
+
'depth' => 0,
|
100
|
+
|
101
|
+
'fallback_cb' => ''
|
102
|
+
|
103
|
+
)); ?>
|
104
|
+
|
105
|
+
</nav>
|
106
|
+
|
107
|
+
<?php else:
|
108
|
+
|
109
|
+
(!is_mobile())?get_template_part('/lib/parts/header-right'):'';
|
110
|
+
|
111
|
+
endif; ?>
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
43
|
-
|
115
|
+
<div class="your-class">
|
44
116
|
|
45
117
|
<?php
|
46
118
|
|
@@ -80,6 +152,10 @@
|
|
80
152
|
|
81
153
|
</div>
|
82
154
|
|
155
|
+
</header>
|
156
|
+
|
157
|
+
|
158
|
+
|
83
159
|
```
|
84
160
|
|
85
161
|
|
3
質問文再編集しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,7 +34,9 @@
|
|
34
34
|
|
35
35
|
### 該当のソースコード
|
36
36
|
|
37
|
-
|
37
|
+
ヘッダーに記事スライダーを設置するために書いたコードです。
|
38
|
+
|
39
|
+
「header.php」に記載しています。
|
38
40
|
|
39
41
|
```ここに言語を入力
|
40
42
|
|
2
使用テーマと公式サイトを追記いたしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -353,3 +353,9 @@
|
|
353
353
|
</section>
|
354
354
|
|
355
355
|
```
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
使用テーマ:「diver」
|
360
|
+
|
361
|
+
公式サイト:https://tan-taka.com/diver/
|
1
コードをコードブロックで囲い、飛び先ページのコードを追記(文字数制限の都合で途中から省略)
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,7 +36,9 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
+
```ここに言語を入力
|
40
|
+
|
39
|
-
<div class="your-class">
|
41
|
+
<div class="your-class">
|
40
42
|
|
41
43
|
<?php
|
42
44
|
|
@@ -75,3 +77,279 @@
|
|
75
77
|
?>
|
76
78
|
|
77
79
|
</div>
|
80
|
+
|
81
|
+
```
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
飛び先(single.php)のコードです。文字制限にかかってしまうため途中からの記述は省いております。
|
86
|
+
|
87
|
+
```ここに言語を入力
|
88
|
+
|
89
|
+
<?php
|
90
|
+
|
91
|
+
global $post;
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
$position = get_theme_mod('sidebar_position_page','right');
|
96
|
+
|
97
|
+
$adremove = get_post_meta($post->ID, "ad_remove", true);
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
$pickup_tag = get_theme_mod('pickup_tag','pickup');
|
102
|
+
|
103
|
+
$pickupposts = get_posts( 'tag='.$pickup_tag );
|
104
|
+
|
105
|
+
?>
|
106
|
+
|
107
|
+
<?php get_header(); ?>
|
108
|
+
|
109
|
+
<div id="main-wrap">
|
110
|
+
|
111
|
+
<!-- main -->
|
112
|
+
|
113
|
+
<?php $sidebarset = get_post_meta($post->ID, 'single_sidebar_settings', true); ?>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<main id="single-main" <?php if(!empty($sidebarset)){ echo 'class="full"'; } ?> style="<?php echo main_position() ?>" role="main">
|
118
|
+
|
119
|
+
<?php (is_active_sidebar( 'single-top-widget' ))?dynamic_sidebar('single-top-widget'):''; ?>
|
120
|
+
|
121
|
+
<?php if(get_theme_mod('catnewpost','top')=="top"&&$pickupposts&&$pickup_tag): ?>
|
122
|
+
|
123
|
+
<?php get_template_part('/lib/parts/pickup','post'); ?>
|
124
|
+
|
125
|
+
<?php endif; ?>
|
126
|
+
|
127
|
+
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
128
|
+
|
129
|
+
<!-- パンくず -->
|
130
|
+
|
131
|
+
<?php echo (get_theme_mod('breadcrumb_set_post',true))?get_template_part('/lib/parts/breadcrumb'):''; ?>
|
132
|
+
|
133
|
+
<div id="content_area" class="fadeIn animated">
|
134
|
+
|
135
|
+
<?php get_template_part('/lib/parts/sns','side') ?>
|
136
|
+
|
137
|
+
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php if(diver_fix_sns_boolean()): ?> style="margin-<?php echo ($position=='left')?'right':'left'; ?>: 120px"<?php endif; ?>>
|
138
|
+
|
139
|
+
<header>
|
140
|
+
|
141
|
+
<div class="post-meta clearfix">
|
142
|
+
|
143
|
+
<div class="cat-tag">
|
144
|
+
|
145
|
+
<?php
|
146
|
+
|
147
|
+
foreach((get_the_category()) as $cat): ?>
|
148
|
+
|
149
|
+
<div class="single-post-category" style="background:<?php echo get_theme_mod($cat->slug);?>"><a href="<?php echo get_category_link( $cat->cat_ID ) ?>" rel="category tag"><?php echo $cat->cat_name; ?></a></div>
|
150
|
+
|
151
|
+
<?php endforeach; ?>
|
152
|
+
|
153
|
+
<?php
|
154
|
+
|
155
|
+
if(get_theme_mod('post_tag',true)):
|
156
|
+
|
157
|
+
$posttags = get_the_tags();
|
158
|
+
|
159
|
+
if ($posttags) {
|
160
|
+
|
161
|
+
foreach($posttags as $tag) {
|
162
|
+
|
163
|
+
echo '<div class="tag"><a href="'. get_tag_link($tag->term_id) .'" rel="tag">'. $tag->name ."</a></div>";
|
164
|
+
|
165
|
+
}
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
endif; ?>
|
170
|
+
|
171
|
+
</div>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<h1 class="single-post-title entry-title"><?php echo get_the_title(); ?></h1>
|
176
|
+
|
177
|
+
<div class="post-meta-bottom">
|
178
|
+
|
179
|
+
<?php if(get_theme_mod('single_published_date',true)): ?>
|
180
|
+
|
181
|
+
<time class="single-post-date published updated" datetime="<?php the_time('Y-m-d'); ?>"><i class="fa fa-calendar" aria-hidden="true"></i><?php the_time(get_option( 'date_format' )); ?></time>
|
182
|
+
|
183
|
+
<?php endif; ?>
|
184
|
+
|
185
|
+
<?php if(get_theme_mod('single_modified_date',true)): ?>
|
186
|
+
|
187
|
+
<time class="single-post-date modified" datetime="<?php the_modified_date('Y-m-d'); ?>"><i class="fa fa-refresh" aria-hidden="true"></i><?php the_modified_date(get_option( 'date_format' )) ?></time>
|
188
|
+
|
189
|
+
<?php endif; ?>
|
190
|
+
|
191
|
+
<?php if(get_theme_mod('single_finish_time',false)): ?>
|
192
|
+
|
193
|
+
<span class="post_reading_time">
|
194
|
+
|
195
|
+
<?php
|
196
|
+
|
197
|
+
echo diver_post_reading_time($post->post_content);
|
198
|
+
|
199
|
+
?>
|
200
|
+
|
201
|
+
</span>
|
202
|
+
|
203
|
+
<?php endif; ?>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
<?php if(get_theme_mod('single_title_author',true)): ?>
|
210
|
+
|
211
|
+
<ul class="post-author vcard author">
|
212
|
+
|
213
|
+
<li class="post-author-thum"><?php echo get_avatar(get_the_author_meta('ID'), 25); ?></li>
|
214
|
+
|
215
|
+
<li class="post-author-name fn post-author"><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author(); ?></a>
|
216
|
+
|
217
|
+
</li>
|
218
|
+
|
219
|
+
</ul>
|
220
|
+
|
221
|
+
<?php endif; ?>
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<?php
|
226
|
+
|
227
|
+
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
|
228
|
+
|
229
|
+
if($paged==1):
|
230
|
+
|
231
|
+
?>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<?php if(get_option('diver_postsettings_icatch_on',get_theme_mod('single_icatch',1))): ?>
|
236
|
+
|
237
|
+
<?php $eye_img = wp_get_attachment_image_src( get_post_thumbnail_id() , 'medium' ); ?>
|
238
|
+
|
239
|
+
<figure class="single_thumbnail" <?php echo (get_option('diver_postsettings_icatchbg_on',get_theme_mod('single_icatch_bg',1)))?'style="background-image:url('.$eye_img[0].')"':''; ?>>
|
240
|
+
|
241
|
+
<?php echo get_diver_thumb_img('full',false,'',true ,false); ?>
|
242
|
+
|
243
|
+
</figure>
|
244
|
+
|
245
|
+
<?php endif; ?>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<?php sharebtn(get_option('diver_sns_post_top_style',get_theme_mod('sharebtn_style_top','big')),'top'); ?>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<?php endif; ?>
|
254
|
+
|
255
|
+
</header>
|
256
|
+
|
257
|
+
<section class="single-post-main">
|
258
|
+
|
259
|
+
<?php if(!$adremove):
|
260
|
+
|
261
|
+
dynamic_sidebar('single-top');
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
if(get_option('diver_option_base_ad_posttop') != 4){
|
266
|
+
|
267
|
+
echo diver_option_get_adsence(get_option('diver_option_base_ad_posttop'));
|
268
|
+
|
269
|
+
}else{
|
270
|
+
|
271
|
+
echo do_shortcode(get_option('diver_option_base_ad_posttop_custom'));
|
272
|
+
|
273
|
+
}
|
274
|
+
|
275
|
+
elseif(get_post_meta(get_the_ID(),'single_adarea_top',true)): ?>
|
276
|
+
|
277
|
+
<div class="single-top">
|
278
|
+
|
279
|
+
<?php echo do_shortcode(get_post_meta(get_the_ID(),'single_adarea_top',true)); ?>
|
280
|
+
|
281
|
+
</div>
|
282
|
+
|
283
|
+
<?php endif; ?>
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
<div class="content">
|
290
|
+
|
291
|
+
<?php if($post->post_password){echo apply_filters('the_content', get_post_meta(get_the_ID(),'auth_before_content',true));} ?>
|
292
|
+
|
293
|
+
<?php the_content(); ?>
|
294
|
+
|
295
|
+
</div>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
<?php get_template_part('/lib/parts/pager-next-links'); ?>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<?php if(!$adremove):
|
304
|
+
|
305
|
+
if(get_option('diver_option_base_ad_postbottom') != 4){
|
306
|
+
|
307
|
+
echo diver_option_get_adsence(get_option('diver_option_base_ad_postbottom'));
|
308
|
+
|
309
|
+
}else{
|
310
|
+
|
311
|
+
echo do_shortcode(get_option('diver_option_base_ad_postbottom_custom'));
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
?>
|
316
|
+
|
317
|
+
<div class="bottom_ad clearfix">
|
318
|
+
|
319
|
+
<?php (is_mobile())?dynamic_sidebar('single-spad'):dynamic_sidebar('single-pcad'); ?>
|
320
|
+
|
321
|
+
</div>
|
322
|
+
|
323
|
+
<?php else:
|
324
|
+
|
325
|
+
if(is_mobile()&&get_post_meta(get_the_ID(),'single_adarea_bottom_sp',true)){ ?>
|
326
|
+
|
327
|
+
<div class="bottom_ad clearfix">
|
328
|
+
|
329
|
+
<?php echo do_shortcode(get_post_meta(get_the_ID(),'single_adarea_bottom_sp',true)); ?>
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
<?php }
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
if(!is_mobile()&&get_post_meta(get_the_ID(),'single_adarea_bottom_pc',true)){ ?>
|
338
|
+
|
339
|
+
<div class="bottom_ad clearfix">
|
340
|
+
|
341
|
+
<?php echo do_shortcode(get_post_meta(get_the_ID(),'single_adarea_bottom_pc',true)); ?>
|
342
|
+
|
343
|
+
</div>
|
344
|
+
|
345
|
+
<?php }
|
346
|
+
|
347
|
+
endif; ?>
|
348
|
+
|
349
|
+
<?php sharebtn(get_option('diver_sns_post_bottom_style',get_theme_mod('sharebtn_style_bottom','big')),'bottom'); ?>
|
350
|
+
|
351
|
+
<?php get_template_part('/lib/parts/parts','author'); ?>
|
352
|
+
|
353
|
+
</section>
|
354
|
+
|
355
|
+
```
|