Jetpack Infinite scroll conflicting with theme’s pre_get_posts custom posts_per_page

You’ve specified a priority of 1 for your pre_get_posts function here: add_action( ‘pre_get_posts’, ‘mytheme_portfolio_archive_pages’, 1 ); Jetpack doesn’t specify a priority: add_action( ‘pre_get_posts’, array( $this, ‘posts_per_page_query’ ) ); So that gets added with the default priority for add_action, which is 10: $priority (int) (optional) Used to specify the order in which the functions associated with … Read more

Need help understanding pagination parameters

The following code line: $paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1; is using the ternary operator ?: It’s a shorthand notation for if( get_query_var( ‘paged’ ) ) $paged = get_query_var(‘paged’ ); else $paged = 1; This can in fact be simplified further, by using the the second input parameter for the default value, … Read more

Keep Pagination in Tabs

Use the following extension to the WP_Query class. The extension only takes your arguments as an array, rather than a string format. You’ll to add individual values for “page_link” for each of your tabs. This should just be a string (“tab1”, “tab2” etc etc) Then you’ll need to use the $my_query->next() and $my_query->prev() to add … Read more

Possible to paginate on single.php?

I think the easiest implementation would be to put your infinite scroll in category.php, and then, either using Dashboard -> Settings -> Reading -> Posts per page, or via direct query modification, display one post per page. Otherwise, depending on how you’re implementing the infinite scroll, you could make use of next_post_link() and previous_post_link(), both … Read more

How to grab a specific page of content from paginated post?

nextpage pagination is a bit odd. You will have to parse the post content. This should do it. function get_nth_page($n=0,$content=””) { if (empty($content)) { global $post; $content = $post->post_content; } if (empty($content)) { return false; } $content = str_replace(“\n<!–nextpage–>\n”, ‘<!–nextpage–>’, $content); $content = str_replace(“\n<!–nextpage–>”, ‘<!–nextpage–>’, $content); $content = str_replace(“<!–nextpage–>\n”, ‘<!–nextpage–>’, $content); $pages = explode(‘<!–nextpage–>’, $content); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)