質問編集履歴
1
追記
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -53,4 +53,49 @@
|
|
|
53
53
|
get_template_part('each_exrpt_post');
|
|
54
54
|
endwhile;
|
|
55
55
|
?>
|
|
56
|
-
```
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
解決していないため、追記します。
|
|
60
|
+
ソースは簡略にしたところこういった感じです。
|
|
61
|
+
```php
|
|
62
|
+
<?php get_header(); ?>
|
|
63
|
+
<p class="search">「<?php the_search_query(); ?>」の検索結果</p>
|
|
64
|
+
<?php
|
|
65
|
+
if (have_posts() && get_search_query()) :
|
|
66
|
+
while (have_posts()) :
|
|
67
|
+
the_post();
|
|
68
|
+
get_template_part('each_exrpt_post');
|
|
69
|
+
endwhile;
|
|
70
|
+
?>
|
|
71
|
+
<div id="post-<?php the_ID(); ?>" class="">
|
|
72
|
+
<div class="section">
|
|
73
|
+
<h4><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php echo get_the_title(); ?></a></h4>
|
|
74
|
+
</div>
|
|
75
|
+
<?php if ( $wp_query -> max_num_pages > 1 ) : ?>
|
|
76
|
+
<div class="pager"><?php next_posts_link('« 古い記事'); previous_posts_link('新しい記事 »'); ?></div>
|
|
77
|
+
<?php endif; ?>
|
|
78
|
+
<!-- /pager -->
|
|
79
|
+
<?php else: ?>
|
|
80
|
+
<div class="section">
|
|
81
|
+
<p>お探しの記事は見つかりませんでした。</p>
|
|
82
|
+
</div>
|
|
83
|
+
<?php endif; ?>
|
|
84
|
+
<?php get_sidebar(); ?>
|
|
85
|
+
<?php get_footer(); ?>
|
|
86
|
+
```
|
|
87
|
+
↑search.php
|
|
88
|
+
|
|
89
|
+
```php
|
|
90
|
+
//function.phpに特定の記事を検索結果に出さないように追記
|
|
91
|
+
function fb_search_filter($query) {
|
|
92
|
+
if ( !$query -> is_admin && $query -> is_search) {
|
|
93
|
+
$query -> set('post__not_in', array(43, 27, 9, 85, 7, 64, 31, 36, 73, 5,) );
|
|
94
|
+
}
|
|
95
|
+
return $query;
|
|
96
|
+
}
|
|
97
|
+
add_filter( 'pre_get_posts', 'fb_search_filter' );
|
|
98
|
+
```
|
|
99
|
+
↑functions.php
|
|
100
|
+
|
|
101
|
+
すみません、長々となってしまいましたが助言をください。
|