Need some Tweak my nextpage Function
Need some Tweak my nextpage Function
Need some Tweak my nextpage Function
Your expectation isn’t right. Numbers are only added to pages 2 & higher. The first page retains the single page’s slug.
If next/prev posts exist, the next/prev button will show. What i did here is to modify the next/prev labels 🙂 while( have_posts() ) : // Your loop endwhile; // Pagination $pagination_args = array( ‘prev_text’ => ‘<i class=”fa fa-chevron-right” aria-hidden=”true”></i>Previous post’, ‘next_text’ => ‘Next post<i class=”fa fa-chevron-left” aria-hidden=”true”></i>’ ); ?> <div class=”paginate_container”><?php echo paginate_links( $pagination_args ); … Read more
Using
How is the Page Splitting implemented in the theme?
You can explicitly set the ‘like’ URL. If you play with the form FaceBook provides you can see how that works. <div class=”fb-like” data-href=”http://example.com” data-send=”true” data-width=”450″ data-show-faces=”true”></div> If you don’t set the URL the default is the current URL, so you will have multiple pages. So, and this is the only WordPress part of this … Read more
I just tried this and it works for me. Given that you would like to exclude page id 4 this is the code you are looking for. <?php $pagelist = get_pages(‘sort_column=menu_order&sort_order=asc&exclude=4’); $pages = array(); foreach ($pagelist as $page) { $pages[] += $page->ID; } $current = array_search($post->ID, $pages); $prevID = $pages[$current-1]; $nextID = $pages[$current+1]; ?> <div … Read more
Crib a bit of code from wp-includes/query.php and bit from wp-includes/post-template.php, add a little, mix and stir, and… function url_to_last_page() { global $post; $content = str_replace(“\n<!–nextpage–>\n”, ‘<!–nextpage–>’, $post->post_content); $content = str_replace(“\n<!–nextpage–>”, ‘<!–nextpage–>’, $content); $content = str_replace(“<!–nextpage–>\n”, ‘<!–nextpage–>’, $content); $pages = explode(‘<!–nextpage–>’, $content); $numpages = count($pages); $ret = _wp_link_page($numpages); $ret .= $numpages; $ret .= ‘</a>’; return … Read more
If you use <!–nextpage–> tag, then you could use wp_link_pages function. Just put it in your single.php template.
In your single.php add this example code inside the loop: <?php global $page; if ($page == 1) {?> <div style=”color:red;”>This text should only appear on first page of the post!!!</div> <?php } ?> you can change the div with your thing that you wanted to display only on the first post page..