• Resolved olistic

    (@olistic)


    Hi,

    As I haven’t been able to fix an issue due to Pagination plugin (see “Strange redirection in pagination”) I’ve decided to just use the “basic” of my website.

    Can you please help me to add the “basic” pagination I see in the posts or pages (i.e. https://www.yogajap.com/lo-yoga/) in my blog page, where now I’m not able to see all the posts (I see just the number of the posts set in Settings-Reading-Blog pages show at most)?

    And then, can you please help me have the same pagination here -> https://www.yogajap.com/?s=yoga (I don’t know why, here it looks totally different – i.e. it’s not centered as the basic one).

    Thank you in advance!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter olistic

    (@olistic)

    I’ve tried to do as it is described by https://www.usablewp.com/learn-wordpress/building-the-blog/how-to-add-pagination-to-blog-posts-index/ but it doesnt work.

    If I add the the_posts_pagination()?function to the page where I want the pagination, I see it (you can see it now), but all the numbers of the pagination always send the user to the first page (even if the link looks different) :-\

    Why???

    The https://www.yogajap.com/lo-yoga/ page is a page, not a blog post. Apparently the content of the page is presented on 2 pages. If I click on page 2, I see a different content there than on page 1. So content-wise, I’m fine with it the way it is.

    The styling on the search results page is so strange since the pagination is not surrounded by any div with the class “page-links”. I don’t know how you build the template, is this from you? Then you would have to add that in the template for the search results.

    Thread Starter olistic

    (@olistic)

    First of all thank you for your reply.

    In the page lo-yoga the pagination works fine (ad I’d like to have it everywhere in my site).

    The main issue is in the index of the blog (https://www.yogajap.com/blog/), where I can see the pagination, but all the numbers-link always redirect me to the first page (so users can’t view all my posts) :-\

    Are you able to figure out why this happens?

    I can understand it, but I can’t see the reason. Since you seem to be using a custom theme, I can’t tell what the reason is. Technically, the pagination would have to be included in the database query to the archive view. If you wrote this yourself, you would have to take a closer look at its parameters.

    Thread Starter olistic

    (@olistic)

    Hi,

    I’ve tried in the past to overcome this issue using a plugin, but the plugin had the same issue :-\

    I’ve asked to the plugin support and they just told me that there is something wrong with a query
    <?php
    // The Query
    query_posts( ‘cat=33’ );

    but they weren’t able to tell me how to edit it in order to fix the issue (they told me to switch theme to try if with a standard theme the issue was fixed… but doing it I’ve almost lost my site – I’ve been lucky to have a database backup to restore!)

    Here’s the code – https://pastebin.pl/view/77ba7b59 – and I don’t know how to edit that query… Do you have any idea?

    Anyway thanks in advance

    Thread Starter olistic

    (@olistic)

    Searching and searching and searching, I’ve found the solution here (just in case it helps anyone with a similar problem) -> https://stackoverflow.com/questions/50169711/pagination-not-working-with-query-posts

    Using

    $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $args = array(
    ‘category_name’ => ‘name-category‘,
    ‘posts_per_page’ => 15,
    ‘paged’ => $page
    );
    query_posts($args);

    instead of

    query_posts( ‘cat=33’ );

    now the number-links of pagination work fine ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding pagination to blog page’ is closed to new replies.