I tried different codes to be able to use the PageNavi Plugin in category.php, but all were not working. I don't know what was the problem? here is my working category.php code: <?php $cat = get_the_category(); $cat = $cat[0]; $catname = get_cat_name($cat->term_id); $catid = get_cat_ID($catname); ?> <?php $paged = get_query_var('paged', 1); $args = array( 'paged' => $paged, 'post_type' => 'post', 'cat' => $catid, ); $query = new WP_Query($args); global $query_string; query_posts( $query_string . "&posts_per_page=1&paged=".$paged ); while ( have_posts() ) : …
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 set post per page from setting>maximum post per page to 20. I have 2 different custom post types 'book' and 'author' for archives of each of them. I want to load different number of post in page. I want to load 20 book per page in book archive and 5 post in author archive in each page. I also use WP-PageNavi plugin. Here is my code <?php $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $args …
I'm using a page as archive for a custom post type called event. register_post_type('event', array( 'labels' => array( 'name' => 'Événements', 'singular_name' => 'Événement', ), 'public' => true, 'has_archive' => false, 'hierarchical' => false, 'menu_icon' => 'dashicons-calendar-alt', 'rewrite' => array( 'with_front' => false, 'slug' => 'evenements' ) )); Then, I defined this page template to template-event.php, where I use the following code to loop through post types. $args = array( 'post_type' => 'event', 'posts_per_page' => 6, 'paged' => get_query_var('paged') ); …
I am using PageNavi and have been searching around trying to figure out why I can't get pagination to work. Currently, the page numbers show but when you click on the page numbers, it goes to a page not found page. Here are some links I've reviewed: https://toolset.com/forums/topic/help-to-get-wp-pagenavi-working-for-page-2-onwards/ pagenavigation not showing the next page just linking back to the main page Here is my code: <?php /*Query DW Hammer Articles*/ $counter = 1; //counter tracks the number of the post …
I am using WP-PageNavi plugin, which I incorporated into my custom tpl page. There is woocommerce shortcode which holds all the products that I want to display, but I only ever see the same ones and only one page results. I do not see what am I doing wrong. The code is: <?php /* Template Name: shine*/ ?> <?php get_header(); ?> <div class="wrapper clearfix"> <?php $args = array( 'post_type' => 'page', 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => 5, …
I have some problems in making wp_pagenavi works. I have a custom post archive page in which I activated the function. Here's the code: <?php // WP_Query arguments $args = array( 'post_type' => array( 'connazionali' ), 'nopaging' => false, 'paged' => '1', ); // The Query $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); the_title(); the_content(); } wp_pagenavi( array( 'query' => $query )); } else { // no …
I have some custom content types on my WordPress website. In order to use pagination I am using wppagenavi plugin and it works fine except in a single custom content type page template that I create a custom query to show the related custom content types. It shows the pagination links correctly like below: Single Research Field Post: http://localhost/research-field/reports/ Url to the second page created by wppagenavi: http://localhost/research-field/reports/page/2 But when I click on the second page it redirects to the …
I have a custom post type called pizza with a custom taxonomy called genero. mypage/pizza/peperoni/ When I click subsequent paginated page links (e.g. [2], [3], [next]) mypage/pizza/peperoni/page/2 The post is displayed correctly, but when I try to go to next-page [2], takes me to an 404 page my loop <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 2; $args = array( 'posts_per_page' => 2, 'order' => 'DESC', 'tax_query' => array( array( 'taxonomy' => 'genero', 'field' => 'slug', 'terms' => 'peperoni', 'paged' …
I would like to have my single-{slug}.php perform a query on a list of posts from different custom post type and use pagination. The pagination appears but unfortunately, clicking the pagination does not go to that page and always remains on page 1. Currently using WP-navi, btw. Example: Load the list of post from single-sports.php onto single-movies.php Any advice or help would be appreciated. Here's my single-{slug}.php: <?php $args = array( 'post_type' => 'crew', 'paged' => ( get_query_var('paged') ? get_query_var('paged') …
I have two parent categories, and pagination is working fine on them - the paged url's show as: /parent-category-1/page/2/ ... etc /parent-page/parent-category-2/page/2/ ... etc However, when I go to a child-category, pagination returns a 404 - for e.g.: /category/parent-category-1/child-category/page/2/ ... etc = 404 /category/parent-category-2/child-category/page/2/ ... etc = 404 I'm using the WP-PageNavi plugin for my pagination. I don't have any custom permalinks set in my permalinks options. parent-category-1 parents the categories for my standard blog posts. parent-category-2 parents the categories …
I'm ussing in my site that code: category-anuncios.php <div class="listado-anuncios"> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $query=array("category_name"=>"anuncios","order"=>"ASC","posts_per_page"=>"1","page"=>$paged); $objAnuncio = new WP_Query($query); if ($objAnuncio->have_posts()){ ?> <ul> <?php while($objAnuncio->have_posts()){ $objAnuncio->the_post(); ?> <li> <?php the_title(); ?> </li> <?php } ?> </ul> <?php if (function_exists("wp_pagenavi")){wp_pagenavi(array("query"=>$objAnuncio));} wp_reset_postdata(); } ?> </div> I can see the content of my post well and show too the navigation...but, if I try to navigate to the second, third or other I have the error 404. How can use …
I have to output page, parameters( Page Url, Page Name, and Page's featured image) in javascript loop, one by one I think we can display it through NavMenuItems or NavMenu functions Pages displayed will be those a user is allowed to see e by user hierarchy, Any suggestions on how to proceed...??
Is there any way to allow navigation in an article within same post in Wordpress. or any such plugins ? Because i searched a lot, but could not find a way. For example : Check this link http://www.mbaskool.com/fun-corner/top-brand-lists/3457-top-10-automobile-brands-of-the-world-2012.html?start=6 where we can navigate through top 10 items of same post
I'm trying to fix an error with pagination of WP page Navi plugin. After I've added posts_per_page parameter to the query I'm getting 404 error when clicking on link page3,4 etc (there are 10 records totally) and after page 8 (where there around 60 records totally). Without this parameter it works fine but I want to display various number of posts under categories. Here is the code of one of the pages I'm trying to fix: $paged = (get_query_var('paged')) ? …
I am having trouble with wp_pagenavi working on the start page using a custom query. It's working well on every standard template like category.php. But not on the homepage. Here is the code: <?php $args=query_posts(array( 'post__not_in'=> array(419), 'post_type' => 'post', 'posts_per_page' => 10, 'paged' => get_query_var('page'), )); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php $featuredImage = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); $s1=strtolower($title); ?> <div id="post-<?php echo $post->ID;?>" <?php $item_format = is_video() ? 'video' : 'post'; …
We suppose that a category has 1000 posts, we can use the following code to show 10 posts per page and the wp pagenavi would present 100 pages with links of above 1000 posts. <?php query_posts($query_string."&showposts=10&orderby=date&order=ASC") ?> Is there any way that I show only 100 recent posts and hide remaining 900 posts because they may be too old? I used the numberpost but it did not work. My code is as follows: <?php query_posts($query_string."&showposts=10&numberposts=100&orderby=date&order=ASC") ?> <?php $mypage = (get_query_var('paged')) …
I have a custom post type called rock with a custom taxonomy called genero. taxonomy-genero-curiosity.php mypage/Rock/curiosity/ When i click subsequent paginated page links (e.g. [2], [3], [next]) mypage/Rock/curiosity/page/2 takes me to an 404 page. <?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; //for a given post type, return all $args = array( 'tax_query' => array( array( 'taxonomy' => 'genero', 'field' => 'slug', 'terms' => 'curiosity' ) ), 'post_type'=>'', //add your post type name 'posts_per_page' …