Tag Info

New answers tagged

2

The homepage and all archive pages (date, category, tag, taxonomy and author pages ) uses the same default pagination functions for pagination. What this means is, the_posts_pagination works on all archive pages and the home page. The only differences on these pages is the content which is determined by the main query. As far as pagination goes, it is ...


1

By seeing your code, you are creating the $args array but not passing it to the WP_Query. Try using the below way. $args = array( 'posts_per_page' => 7, 'offset' => '5', 'paged' => $paged ) ; $my_query =new WP_Query($args); ......


0

There exists filter: wp_link_pages_args (also, wp_link_pages_link): add_filter( 'wp_link_pages_args', 'my_function', 11, 1 ); function my_function($base_parameters){ $new_parameters = array( 'before' => '<p class="my_class">' . __( 'Pages:' ), 'after' => '</p>', 'link_before' => '', ...


0

I changed my approach in the end. I just called a single query and added the logic to check the date of the last post was in a different month: $today = date("r"); $articledate = get_the_time('r'); $difference = round((strtotime($today) - strtotime($articledate))/(24*60*60),0); if ($month_sort == true ...


0

Try to following way-- <?php $prv_post = get_previous_post(); $next_post = get_next_post(); ?> <?php if(!empty($prv_post)) { ?> <a href="<?php echo get_permalink($prv_post->ID ); ?>" class="prev" rel="prev"> <span class="meta-nav"><?php _e('Previous Post', 'awe') ?></span> <span class="nav-icon"><i ...


0

when writing this question we suddenly thought that we did not try to change the permalink. After changing the permalink to another unique value it worked like a charm. So still not sure what was causing this issue but the above solved the issue. If anyone has a clue why the permalink was causing the problem please let us know, might help us by ...


0

Found the solution. I am using get_next_post() and get_previous_post() functions which works perfectly.


0

So I ended getting what I wanted to do with below code. However, I know this is not a good way to do this. Please feel free to share your advice on this code. global $wpdb; global $post; // Pagination Setup $posts_per_page = 20; $start = 0; $paged = get_query_var( 'paged') ? get_query_var( 'paged', 1 ) : 1; // Current page number $start = ...


1

Lets clean this up: <h2> <?php $num = $wp_query->post_count; if (have_posts()) :?> <a href="<?php the_permalink(); ?>"><?php the_title();?></a> <?php endif;?> <?php $search_count = 0; $search = new WP_Query("s=$s & showposts=5"); if($search->have_posts()) : while($search->have_posts()) : ...


0

As suggested by @s_ha_dum, you can check the value of page. The value is 1 when you're on the first page. global $page; if ( $page == 1 ) : // you're on the first page endif; But probably you need to check if the post is paginated first: global $multipage; if ( 0 !== $multipage ) : global $page; if ( $page == 1 ) : // you're on the ...


0

I am not sure why your code doesn't work, but you should be able to check the page global. It should be a positive number on all but first page of a pages post. $page is NULL on the first page but set to an integer otherwise. The following should work, and does when I test it. global $page; if (empty ($page)) { echo 'first page'; } ... should work.


0

Please replace your first line for fill $portfolioloop via query with below code: $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $portfolioloop = new WP_Query( array('posts_per_page' => '2', 'paged'=>$paged // add any other parameters to your wp_query array ) ); And see what is the result you are getting ...



Top 50 recent answers are included