Tag Info

New answers tagged

1

you CANT have a PAGE and a CUSTOM POST TYPE with the same name Maybe tree years ago it was impossible, but now you CAN. First, add this lines to $args into your post type: 'has_archive' => false, 'rewrite' => array( 'slug' => 'your slug', // if you need slug 'with_front' => false, ...


1

If it can help anyone, here is the full answer with the issues that might happen when you want to add Wordpress pagination with anchors to a template page. STEP 1 Follow the example on the Codex so that the paginate_links() function applies to your custom query and not to the main query. STEP 2 Your function should look like the code below : global ...


1

1.Login as the admin in WordPress. 2.Go to the Settings tab. 3.Go to the Reading tab. 4.Change the Blog pages show at most from the default 10 to any number *less than 10. For example, 5. 5.Save the changes. 6.View the blog. Hope that helps.


2

Do not run custom queries in place of the main query on the home page and any type of archive page. This will always cause an issue. If you need to alter the main query, use pre_get_posts to do so. To solve this issue, you need remove your code from your category page and go back to the default loop. You should only have the following in your category page ...


0

Finally, I've found an answer. Not sure if it's specific in my case or it's a general WP issue but default value for posts per page set up in WP admin (General > Reading > Maximum number of posts per page) should be less than value for posts_per_page parameter for custom query. In my case, I've changed in WP options value to 3 and for other page changed this ...


0

You may want to take a look at this related issue: WP-PageNavi gives me a 404 when using WP Query Some users mentioning that the page name cannot be the same as the post type you are querying, and others that it may be a conflict with another plugin you are running.


1

Maybe it helps function wpcodex_filter_main_search_post_limits( $limit, $query ) { return 'LIMIT 0, 100'; } add_filter( 'post_limits', 'wpcodex_filter_main_search_post_limits', 10, 2 ); More: post_limits filter


0

Try this code that will helps you display only 10 pages. This is code where you want to display the post: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'property', 'posts_per_page' => 10,'paged'=> $paged,'orderby'=> 'meta_value_num','order'=> 'DESC'); $loop = new WP_Query( $args ); ...


2

Before I start, do not use get_posts for paginated queries. get_posts legally breaks pagination, and does not return the query object. If you need to paginate queries, use WP_Query As for your issue, I really don't think limiting the total overall amount of posts to only 100 is possible when you involve pagination. The only scenarios I can think of is: ...


0

Overriding the default page breaking - with external content parts The page breaking takes place in the WP_Query::setup_postdata() method, when we call the_post() in the loop. The page parts are stored in the global $pages array and fetched with get_the_content() function. This happens all before the the_content filter is applied to the content. We can ...


0

I finally figured out how to fix the issue I had. I added the following into my rewrite_rules function: add_rewrite_rule('^mysearch/location/([^/]+)/page/([0-9]{1,})/?$','index.php?page_id=200&location=$matches[1]&paged=$matches[2]','top'); So now my URLs are exactly as I wanted them: /mysearch/location/SUBMITTED-INFO/page/WHATEVER


0

here you just need to change on $args array. where you have pas wrong argument. $args = array ( 'post_type' => 'post', 'posts_per_page' => 3, 'paged' => $paged );


0

You have a few issues here The following piece of code is wrong and unnecessary $category = get_post(); $category = $category->post_title; The current page object is saved in get_queried_object(), so you can use this function to get your post title. Also, post_title is not the correct property to use here. You want to look at the post slug which is ...


0

for this you need to use type parameter $links = paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $posts_array->max_num_pages, 'prev_text' => __( 'Previous page', 'twentyfifteen' ...



Top 50 recent answers are included