2

<!--nextpage-->基本的に、プラグインでいくつかのショートコードを使用して動的に投稿のページネーションを生成するタグを追加しようとしていますが、

このような機能を実行するために、次のコードを使用しようとしました。

public function __construct() {
    add_shortcode('CONTINUED', array(&$this, 'continued_handle'));
}

public function continued_handle() {
    global $post;
    add_filter('the_content', array(&$this, 'your_post_split'));
    return $this->your_post_split($post);
}

public function your_post_split($content) { 
    $output = '<div>In page 1</div>';
    $output .= '<!--nextpage-->';
    $output .= '<div>In page 2</div>';
    return $output;
}

ページでショートコードを使用する場合、WordPress で通常行うよう[CONTINUED]にエコーして<div>In page 1</div>処理し、ページネーションを開始します。<!--nextpage-->

実際に行っているのは、投稿でこれを返すことです

<div>In page 1</div><!--nextpage--><div>In page 2</div>

実際には<!--nextpage-->、私が望む機能を実行していません

4

0 に答える 0