Solution to WP paging failure:
1. Log onto the background of the blog and click "edit" under the "Appearance" tab to go to the topic editing page.
2. Find
The code is as follows: |
Copy code |
<? Php query_posts ('showposts = 9 & cat = 25 ');? Then change: <? Php $ limit = get_option ('posts _ per_page '); $ Paged = (get_query_var ('paged '))? Get_query_var ('paged'): 1; Query_posts ('& showposts ='. $ limit = 5. '& paged ='. $ paged. '& cat = 25 '); $ Wp_query-> is_archive = true; $ wp_query-> is_home = false; ?> |
5 After limit is the number of files displayed on each page, and 25 is the ID number of the category.
4. Save the update file.
Query_posts paging failure solution
Query_post is indeed powerful. You can use it to customize the articles you want to call. Now, we want to use it to implement the pagination of articles, in my topic, I set 10 articles on each page in the background, but in my image category, I want to display 9 images. The following code is required:
The code is as follows: |
Copy code |
<? Php Query_posts ('showposts = 9 & cat = 64 & prime ;); If (have_posts (): while (have_posts (): the_post ();?> <Div class = "pic" id = "post-<? Php the_ID ();?>" <? Php post_class () ;?>> ..... </Div> <? Php endwhile; endif;?> |
In this way, nine images are displayed on each page, but the content on the second page is the same as that on the first page...
Modify the code here.
The code is as follows: |
Copy code |
<? Php $ Limit = get_option ('posts _ per_page '); $ Paged = (get_query_var ('paged '))? Get_query_var ('paged'): 1; Query_posts ('& showposts ='. $ limit = 9. '& paged ='. $ paged. '& cat = 9 & prime ;); $ Wp_query-> is_archive = true; $ Wp_query-> is_home = false; If (have_posts (): while (have_posts (): the_post ();?> <Div class = "pic" id = "post-<? Php the_ID ();?>" <? Php post_class () ;?>> ..... </Div> <? Php endwhile; endif;?> |