In my posts I'm using <!--nextpage--> in order to paginate specific blog posts, which works fine. But my issue is that the featured image shows in the post header for each page. I've tried using !is_paged but it's not working and I read that it doesn't work for posts using <!--nextpage--> The code I'm using: if (isset($props['featured_in_head'])) { if ( !is_paged() ){ $props['featured'] = $props['featured_in_head']; } } I've noticed on the sub-pages of this one post that my body has …
I am working on a Wordpress project where I use the Posts 2 Posts plugin to show posts from one post type to posts from another post type. This works great but for some reason my next_posts_link() and previous_posts_link() doesn't show up. I have specified the paged variable in my code so it should work. Can anyone see what I am doing wrong? $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $connected = new WP_Query( array( 'connected_type' …
I'm building my first theme and have a template page "page-blog" with a custom wp_query. I've tried adding pagination to the query but so far the pagination redirects to the index page. As expected the url structure shows /blog/page/2. What am I doing wrong here? Do I need to just create my own pagination method? <div class="blog-listings"> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'blog', 'post_status' => 'publish', 'posts_per_page' => '2', 'paged' => $paged, …
I am trying to run a function that executes only on the first page of any post. So, if a post is paginated because you have used the <!--nextpage--> tag and you are on page 2 or greater of that article, then the function should not run. Even the Wordpress documentation is confused how to do this: When the page being displayed is "paged". This refers to an archive or the main page being split up over several pages and …
I would like to know why my custom post type pages do not accept paged pages? On a normal page I can list custom post types without problems, but on a custom post type page, it seems impossible. I would like to make custom list pages to list custom posts types based on various queries. I.e. if I would like to list all my custom post types on a page with a pagination, the URL or permalink structure would look …
after hours and dozen of tests and messes... i'm face to the wall and fed up searching (mainly cuz my google's answers are already all clicked !) I'm trying to display paginate_link with a filters taxonomy form (AGAIN ????? ;). With all solutions here, I've found how to get the right numbered pagination in a result of my form only on the first page of the results. The main problem, is in the pagination links, they are using the wrong …
How do I determine if I'm on the very first page of pagination? I'm using WP_Pagenavi. I want to run a function only on the first page of the pagination. I checked the query_var 'paged', it's set to 0 on this page, and then 2, 3 and so on in the later pages (1 is missing!)... Anyone knows a clean solution? Thanks.
I've setup a custom query for my posts (single.php) with pagination, which by the way is working great with the default permalink structure. domain.com/p=ID&paged=2 if I switch the permalinks to /%postname%/ the page/2/ redirects to the first page. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args=array( 'connected_type'=> 'posts_to_posts', 'posts_per_page' => 3, 'paged' => $paged, 'order' => 'ASC', 'connected_items' => get_queried_object() ); $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query( $args ); if ( $wp_query->have_posts() ) : while …
Twenty Eleven Theme... On the home page, I have successfully filtered the loop to display just "Featured" posts with pagination functioning properly through nav links. I'm trying to display posts from all categories on another page called "Unfiltered." Why do the nav links disappear when used on this other page? edit: if I change the value of 'paged' to '1' or '2', I get the 10 posts that I would expect to so 'paged' seems to work depending on the …
I think the title sums the problem up, but I'll explain more with the code below. As you can see, I'm trying to start the loop from the second latest post for some theme reasons which forced me to alter the main loop, and I used the parameter offset to make that work, and everything worked just fine, but after I moved on with the development, I started developing the numbered pagination, and finally got surprised with my altered loop …
I embedded standard code for pagination links and everything is working fine except that clicking the Previous or Page 1 link does not take me back to the first paginated page. This is different from other problems with pagination links reported elsewhere. The code for the pagination links is as follows: $total_pages = $wp_query->max_num_pages; $current_page = max(1, get_query_var('paged')); echo paginate_links(array( 'base' => '%_%', 'format' => '?paged=%#%', 'show_all' => false, 'current' => $current_page, 'total' => $total_pages, 'end_size' => 2, 'mid_size' => …
I'm tearing my hair out over this. I've been tasked with some legacy work on a quite an old site. They have a template for a custom post type called resources. This template has search/filtering functionality which is working as intended, however the masonry/load more functionality is broken. The first set of resources loaded are featured resources. When clicking 'load more' the template executes query, ignoring any featured posts and loading the next batch. It does this fine on first …
I am trying to change pages when I search by category on my website. When I am not searching under a certain category I can switch pages fine but when I am searching for a category I am unable to switch pages. $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $orderby = ( get_query_var( 'orderby' ) ) ? absint( get_query_var( 'orderby' ) ) : 'display_name'; if($_GET['search'] && !empty($_GET['search'])) { $search = $_GET['search']; } …
I need to solve duplicating of posts and pages caused by unexpected paging. I am trying to disable the paging with this function, but it seems I miss something: function wpse_disable_pagination( $query ) { if( $query->is_single() && $query->is_page() ) { $query->set('nopaging', 1 ); } } add_action( 'pre_get_posts', 'wpse_disable_pagination' );
im using this piece of code to show my div only on homepage. <?php if ( is_front_page() ) :?> but it's shown on pagination 2, 3 and so on. is there any help regarding to fixing this issue?
Putt a lot of research in and did a lot of testing for this issue and I don't think I am going to solve this by myself at this point. What we have: A page with a permalink with one shortcode. That shortcode is resolved via plugin, which provides different views / outputs relatively by the url-path: /dashboard/admin <-- the WP page permalink /dashboard/admin/trainers/list <-- path without own permalink This all works fine with this rule: dashboard/admin/(.*) Now to the …
I've created new page in WP administration called Blog and created custom page template for it. In the template, I have a simple paged custom query. $query = new WP_Query(array( 'post_type' => 'post', 'posts_per_page' => 1, 'paged' => $paged )); Everything seems to look ok, except when I manually type bigger page number than is available after the '/page/' part of url. The page won't throw a 404 error but will render the page as normal without the custom loop. …
The home page of my site is set to show the 9 latest posts (via the setting in the admin area), and then at the bottom I have the standard pagination links which allow visitors to view more posts. I would like to have the home page (and only the home page) show 7 latest posts, but then on the subsequent pages - 2, 3, 4 etc have 9 posts showing. I also want the categories and archives to display …
I'm using a custom WP_Query. The code is something like below: $portfolio_args = array( 'post_type' => 'portfolio', 'posts_per_page' => 5, 'paged' => get_query_var( 'page' ) ); $portfolio_query = new WP_Query($portfolio_args); Now, my portfolio post type has 15 entries (thus it is good for 3 pages). I can navigate to all these pages, but the issue is even the pages which does not have any portfolio entry (e.g. /page/4/, /page/5, ...) loads just fine (i.e. throws 200 in response header), whereas, …
I'm not sure if what I'm experiencing is a result of a bug (due to the recent upgrade to 3.1.2) or poor coding. Ever since I upgraded to version 3.1.2 I've been experiencing a problem with two loops on my index page. Here's what I've got for my index page: <?php if ( ! is_paged() && is_front_page() ) { echo '<h6 class="sec1 title">FEATURE</h6>'; $sticky = get_option( 'sticky_posts' ); if ( isset( $sticky[0] ) ) { $args = array( 'posts_per_page' => …