teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

コード変更

2017/01/15 13:27

投稿

退会済みユーザー
answer CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  ```php
4
4
  add_filter( 'content_pagination', function ( $pages, $post ) {
5
- if ( ! is_feed() && ! wp_is_mobile() ) {
5
+ if ( ! is_feed() && ! wp_is_mobile() && 1 < count( $pages ) ) {
6
- $content = str_replace( "<!--nextpage-->", '', $post->post_content );
7
- $pages = array( $content );
6
+ $pages = array( implode( "\n\n", $pages ) );
8
7
  }
9
8
 
10
9
  return $pages;

1

追記

2017/01/15 13:27

投稿

退会済みユーザー
answer CHANGED
@@ -1,4 +1,4 @@
1
- こんな感じでいかがでしょうか?
1
+ そもそも nextpage を処理している部分から、なんとかしないとダメだと思います。というわけで、こんな感じでいかがでしょうか?
2
2
 
3
3
  ```php
4
4
  add_filter( 'content_pagination', function ( $pages, $post ) {