pagination - Wordpress hardcode <!--nextpage--> in php -


in wordpress can split post <!--nextpage-->, if put in code version of post-editor. working me. is, if want hardcode in themes loop file? how can work?

assume have in loop file:

<?php the_excerpt(); ?> <?php the_content(); ?> <?php wp_link_pages(foobarbaz); ?> 

obviously following solution won't work:

<?php the_excerpt(); ?> <!--nextpage--> <?php the_content(); ?> <?php wp_link_pages(foobarbaz); ?> 

i have no clue find right php function executed when <!--nextpage--> gets parsed in code editor. solution can think of creating new post <!--nextpage--> in , somehow try hardcode specific post inside loop file. there has better , cleaner way of doing it...

any suggestions?

not sure you're trying can control number of posts appear on archive page on settings->reading tab.

if want split content in individual posts, think best way hook 'the_content' filter. i'm not sure if have criteria want split post if it's word count , don't want use the_excerpt;, can write function (in theme's functions.php file) this:

add_filter('the_content', 'your_post_split'); function your_post_split($content) { //do content , insert <!--nextpage-->  return $content; } 

when write filters, make sure return variable coming function.

if want prepend post excerpt text, try this:

function your_post_split($content) {  global $post;  $content = $post->post_excerpt . $content;  return $content; } 

take <?php the_excerpt; ?> out of template.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -