8

UPDATE 21-01-2016 19:35 SA TIME - BUG FOUND!!!!! YEAH!!!!!! I finally found the bug. As you stated in your last update, the failure only happens when $post_content has a <!--nextpage--> tag in the content. I tested it, and did confirm that any other page after the page after the <!--nextpage--> returns a 404 and then the page gets redirects back ...


5

If you check out the source of _wp_link_page, you'll see all the URL calculations are coded directly within - you can either lift this code straight out into your own function, or sprinkle a little regex around the existing function: function wpse_204737_get_post_page_url( $i ) { if ( preg_match( '/href="([^"]+)"/', _wp_link_page( $i ), $match ) ) ...


5

Best solution for what you want to accomplish which is essentially to make the next page feature more user friendly for your authors is to add a TinyMCE button that will do this for you. This may be a bit complicated so hold your hat. To avoid this answer being the length of a thesis, I have added comments in all codes to help you understand what each ...


4

Note that there's a syntax error for all those three examples you provided: add_filter('content_pagination', 'custom_content'), 10, 2); add_action('the_post', 'custom_content')); add_action('template_redirect', 'custom_content')); where an extra ) is added. Replace these lines to: add_filter( 'content_pagination', 'custom_content', 10, 2); add_action( ...


4

Here is an alternate technique for adding a button to the wordpress editor TinyMCE for inserting <!-- next-page --> following the <!-- more --> button. This code uses the mce_buttons filter to insert the wp_page button right after the existing wp_more button. Add to functions.php : // add <!-- next-page --> button to tinymce add_filter('...


4

I don't know in what exact order filters are applied to the_content(); and whether that's early enough, but if it doesn't work for you, I believe it is safe to assume that you're right in thinking that the shortcode is applied to late. From /wp-includes/shortcodes.php (line 296, wp 3.2.1) it can be seen that shortcodes are naturally resolved like so: ...


3

A simple if statement should do, so something like this: function my_theme_navigation() { if( get_option( $shortname .'_next_prev_or_paginate' ) == 'Next/Previous Links' ) : // the block for next-prev navigation else : // the code for pagination endif; } I have no way of knowing what the array in your first code block exactly ...


2

Doesn't look like there are proper hooks to modify the output as per your requirements. But you could write a function similar to wp_link_pages() and call that in your theme. The following function would do your trick. function custom_link_pages($args = '') { $defaults = array( 'before' => '<p>' . __('Pages:'), 'after' => ...


2

I had the exact same problem a while ago on one of my themes. My problem was that the theme used query_post to filter out some posts. This caused the pagination to fail. I think this was the code that solved it: <?php if ( is_home() ) { $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=-...


2

Isn't it so that you have exactly 10 posts and you're showing them all on first page. $found_posts - The total number of posts found matching the current query parameters found_posts on your first page shows 10. All of these posts are shown on first page. So there are no posts to show on second page - therefore it's empty.


2

Using the the_posts filter: Here's one idea using the the_posts filter, that fires before setup_postdata() is activated: /** * Replace [nextpage] with <!--nextpage--> through the 'the_posts' filter. * * @see http://wordpress.stackexchange.com/a/183980/26350 */ ! is_admin() && add_filter( 'the_posts', function( $posts ) { $posts = ...


2

There's a bug regarding content pagination links not working when previewing scheduled posts or pages. See ticket #32295 There's already a proposed patch that adds the missing future status check within the _wp_link_page() helper function, that generates the content pagination links. We could e.g. construct a quick-fix like: add_filter( '...


2

It's possible to modify the content pagination with the content_pagination filter. Here's a way to always display the content of the first page: /** * Content Pagination: Always display the content of the first page */ add_filter( 'content_pagination', function( $pages ) { // Nothing to do if there's no pagination if( count( $pages ) <= 1 ) ...


1

Parts of this are easy, and parts of this are not so easy. It depends on how complete of a solution you're looking for. Fixing the native pagination functions, for example, is probably more effort than it's worth. The problem is the fact that "page 0" and page 1 are the same page is baked into the code. Anyway, the first step is to stop WordPress from ...


1

If you're using wp_link_pages() with 'next_or_number' set to 'number' (or not set at all, it's the default), which you presumably are, then you can use the wp_link_pages_link filter. wp_link_pages_link lets you filter the HTML for each individual page link that's output. The 2nd argument, $i, gives you the page number. You can use this to conditionally ...


1

Well, yes, of course. Take a look at this reference: http://codex.wordpress.org/Function_Reference/previous_post_link http://codex.wordpress.org/Function_Reference/next_post_link You can customize it however you like, so you can simply put an html image tag in there. The function must be used in the loop to work. I'd do it like this: <?php ...


1

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..


1

Overriding the default page breaking - with external content parts The page breaking takes place in the WP_Query::setup_postdata() method, when we call the_post() in the loop. The page parts are stored in the global $pages array and fetched with get_the_content() function. This happens all before the the_content filter is applied to the content. We can ...


1

You're looking for: _wp_link_page( $page_number ); Must be used inside loop, and it return the opening tag: http://wpseek.com/function/_wp_link_page/


1

If you look at your browser's error console, you'll see the 404 errors for your background images, which will point to where the issue is. This URL: ../wp-content/themes/themename/images/cat-party.jpg basically says, "go up one directory from the current directory, then from there look in wp-content, then themes, then images, etc..". That works fine on ...


1

If you use <!--nextpage--> tag, then you could use wp_link_pages function. Just put it in your single.php template.


1

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-->', $...


1

Well, you can turn it off completely or use the following code along with some sort of conditional statement to switch it on or off. The multipage part is set up in the setup_postdata() function in wp-includes/query.php. There's an action at the end of the function called the_post. If you hook onto that and then modify the globals that are set up in the ...


1

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 = ...


1

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 ...


1

Haven't checked the plugin you mention... but I use this solution for doing an "author" navigation. I adjusted the functions and this should probably work without the plugin (untested). You need to adjust the ID, and the conditions itself if you want more exclusions. [edit: corrected functions, the queries were missing the menu_order condition] notes: 1)...


1

A simple way I'm using now, is to use 'link_before' and 'link_after' as part of the wp_link_pages args. You can then wrap each number, including the active one, in a tag, then style appropriately.


Only top voted, non community-wiki answers of a minimum length are eligible