• Hi,
    I am working on a WP Theme where I have created a custom page template with detailed “divitis” structure. I want to split this particular page into two or more pages using the <!--nextpage--> Quicktag.
    The code structure is as shown below:

    <?php
    /*
    Template Name: My Template
    */
    ?>
    
    <?php get_header(); ?> 
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <p>This part contains divitis image gallery of page 1</p>
    <!--nextpage-->
    <p>This is an image gallery for page 2</p>
    <?php wp_link_pages(); ?>
    <?php endwhile;?>
    <?php endif; ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    i.e. I am not using the_content(). I am editing the content in a text editor using the structure, as shown above.

    Now the issue is that the <!--nextpage--> is not working. It just outputs a blank. But if I use this Quicktag using the text-area in WordPress GUI, it works fine.
    Kindly help me in understing how can I use <!--nextpage--> in a text editor, and not in WP Text-area.
    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter desertsailors

    (@desertsailors)

    Hi Samboll,
    Thanks for the link. The problem is that I am NOT inserting the content via WP text-area. Instead, I am inserting the entire content inside the page template directly.

    The only thing I want to know is “How to split the content of this one page-template into different pages?”

    The expected result is similar to the one if we use <!--nextpage--> inside the text-area of WP. I was wondering why <!--nextpage--> doesn’t work if inserted directly into the content of a page template (and not through the WP text-area).

    If you’re not using The_Loop to display posts, then WP knows nothing about the nextpage tag. Simple as that, really.

    (nextpage wouldn’t be helpful with Pages either)

    Don’t recall seeing any applicable plugins, but search in the Extend section of this site wouldn’t hurt. I suspect you’re probably going to end up coding the “split page content” manually though since you’re putting the content directly on the Page template.

    Thread Starter desertsailors

    (@desertsailors)

    Hi Chris,
    Thanks for the reply. I am already using The_Loop, but it seems that <!--nextpage--> will be parsed only if it is used inside the_content() function. Otherwise, a normal rendering with HTML output will treat this as an HTML comment.

    I am trying to find any other solution to split a page into multiple pages. (For example, page_id=20&page=2 , page_id=20&page=3 and so on.)

    Is there any other way to create such multiple splitted pages without using <!--more--> or <!--nextpage--> Quicktags? Keeping in mind that I am putting the content directly into the template.

    Thanks very much for your time and quick responses.

    I am already using The_Loop, but it seems that <!–nextpage–> will be parsed only if it is used inside the_content() function.

    Right. Exactly.

    Is there any other way to create such multiple splitted pages without using <!–more–> or <!–nextpage–> Quicktags? Keeping in mind that I am putting the content directly into the template.

    I’m willing to be wrong, but I’d say “nope.” Not with the content directly in the template.

    Thread Starter desertsailors

    (@desertsailors)

    Thanks a lot Chris.
    As a last hope, I tried to understand the processing of WordPress Post in formatting.php, post-template.phpand functions.php, but it was a long and unnecessary approach to alter the core logic and code.

    Lastly, I tried using this:

    <?php function my_content($content)
    {
    	$content = '<p>first page content</p><!--nextpage--><p>second page content</p>';
    	return $content;
    }
    add_filter('the_content', 'my_content');?>

    Expecting that <!--nextpage--> will go through all those WP Post filtering now. But this didn’t worked as well. Anyways, I will keep trying on this to come up with some solution.
    Appreciate your support and help.

    Thanks a lot.

    Let me know if you figure this out. I’d like to be able to pass break a page or a post up into pages directly from the theme as well.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Using <!–nextpage–> via text editor’ is closed to new replies.