• Resolved muchmuch11

    (@muchmuch11)


    How to add text at the end of post but only on the last page only (multiple pages post)? I have some posts that have multiple pages.

    I have this code but this will show at the end of post on every pages

    function author_end_post($content) {
    	if (is_single()) {
    		$content .= '<div id="author">test</div>';
    	}
    	return $content;
    }
    
    add_filter ('the_content', 'author_end_post', 0);
    

    Thanks for the help!

    • This topic was modified 7 years, 1 month ago by muchmuch11.
    • This topic was modified 7 years, 1 month ago by muchmuch11.
    • This topic was modified 7 years, 1 month ago by muchmuch11.
Viewing 1 replies (of 1 total)
  • Thread Starter muchmuch11

    (@muchmuch11)

    Answering my own question, using this function:

    global $multipage, $numpages, $page;
    if( $multipage && $page == $numpages )
        echo 'last page';

    Resolved.

    • This reply was modified 7 years, 1 month ago by muchmuch11.
Viewing 1 replies (of 1 total)
  • The topic ‘How to add text at the end of post on last page only’ is closed to new replies.