Tag Info

New answers tagged

1

You could do this like so: <?php $next_post_link = get_next_post_link( '%link', 'Article Précédent', TRUE ); $previous_post_link = get_previous_post_link( '%link', 'Article Suivant', TRUE ); ?> <?php if ( $next_post_link || $previous_post_link ) : ?> <div class="article_single_prev_next"> <div class="article_prev"> ...


0

I think your problem is at the following lines: if ( get_query_var( 'post_type' ) ) $post_type = get_query_var( 'post_type' ); else $post_type = 'job_listing'; Your post_type var will probably already being set, so you are calling some different post type (the one stored inside the query_vars array with the post_type key), which maybe does not ...


0

You're mixing query string and array parameters. They should either be a single string, like: $wp_query = new WP_Query( 'cat=13&paged=' . $paged ); or an array of key/value parameters, like: $wp_query = new WP_Query( array( 'cat' => 13, 'paged' => $paged ) );


0

Try to get the paged variable set using this : $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; (And I don't think you need to declare it as a global before)


1

As per Milo, you need to read the query var page, but set the query var paged. Try this, $page = 0 == get_query_var('page') ? 1 : get_query_var('page'); $wp_query = new WP_Query( array( 'post__not_in' => array(get_the_ID()), 'category__not_in' => 9, 'post_type' => 'post', 'post_status' => 'publish', ...


1

When using pretty permalinks, the paged query var is for paginated archives, and the pretty permalink format is: http://example.com/category/foo/page/2/ The query var on paginated single posts is page, and the pretty permalink format is: http://example.com/post-name/2/ If you're trying to paginate a secondary loop using the current page number in a ...


0

Add <!--nextpage--> in your post editor to split your post.


0

Thanks Pat J I'have got solution now: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?> <?php $offset = ($paged - 1) * 4;?> <?php $kat = get_field('kategory');?> <?php $query = new WP_Query(array('offset' => $offset,'post_type' => 'modelki', 'taxonomy' => $kat, 'posts_per_page' => '4')); ?>


-1

You're using the argument 'posts_per_page' => '4' in the WP_Query. That is why only 4 posts are showing up per page.


1

You only see ten posts because that is the amount of posts per page set by default in the back end under 'Settings -> Reading -> Blog pages show at most' You can either set that to 14 to display all your 14 posts, or you can use pre get posts or WP_Query to alter the main query/create a custom query to change the number of posts shown on a page.


0

This might work. 1.Open your page.php (or some other custom-page-template.php in which you want to make it work) 2.look for the line where you see <?php the_content(); ?> 3.Insert <?php wp_link_pages(); ?> on the very next line like this <?php the_content(); ?> <?php wp_link_pages(); ?> 4.Go back to your editor and ...


1

Regarding the number of pages displayed, read through the arguments for paginate_links, specifically end_size and mid_size. As for the 404- The problem is there is no page 3. Whether or not a page returns content or loads the 404 template is based on the results of the main query, not your custom query you run in the template. If this is a page post type, ...


0

This is working for me. Try it and it might work for you too. $paged = (get_query_var("paged")) ? get_query_var("paged") : 1; $args = array( 'paged' => $paged, 'posts_per_page' =>9, 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC' ); ...


0

Give something like this a whirl: <?php // Get header get_header(); ?> <?php // Begin loop $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array ( 'posts_per_page' => 1, 'paged' => $paged ); query_posts($args); if (have_posts()) : while (have_posts()) : the_post(); ?> <article> <h1><?php ...


0

If you're using the category archive template you do not need to create a new WP_Query instance. Just filter the main query using pre_get_posts(). Put this in functions php or a plugin: add_action( 'pre_get_posts', wp_se_pre_get_posts' ); function wp_se_pre_get_posts( $query ) { if ( is_admin() || ! $query->is_main_query || ! is_category( ...


2

I think this is what you want. base is set via home_url(), format is page/%#%/, search query arg is added via add_args if it exists: $args = array( 'base' => home_url( '/%_%' ), 'format' => 'page/%#%/', 'current' => max( 1, get_query_var('paged') ), 'total' => $temp->max_num_pages, ); if( isset($_GET['s']) ){ ...


0

If you have multiple loops in same page (for ex. in front_page) , sometimes pagination gets broken. I have solved problem by using same query name; From above example we used $myqueryis = $another_query; and in function we used 'total' => $myqueryis->max_num_pages, and also I gived the query args and query like this; $args = array( 'post_type' ...


0

While looking for a solution I got this post: Taxonomies with same slug as CPT So basically you need to add custom rewrite rules, I haven't tested the solution but I guess it will work out for you. /* Register CPT */ function wpse_138987_post_type_filter() { register_post_type('filter', array( 'labels' => array( 'name' => 'Filter', ...


1

Add the next lines of code to functions.php file within active theme to start session. function example_login() { if ( ! session_id()) { session_start(); } } add_action( 'init', 'example_login' ); and then Use $_SESSION to store the value of $post



Top 50 recent answers are included