Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter westham60

    (@westham60)

    Thanks for this, George. Looking at my hosting dashboard, there is a Flush Cache option, so I have done that and we shall see (there is no reference to Cloudflare).

    Thread Starter westham60

    (@westham60)

    Saurabh

    As far as I can tell, this (free) version of WP-Optimise doesn’t have the option of having precaching on/off or clearing it. There is an option for a Scheduled preload which is already off, and a button to manually run (but not clear) Preload.

    I have turned off page caching within WP-Optimise entirely.

    • This reply was modified 1 month, 1 week ago by westham60.
    Thread Starter westham60

    (@westham60)

    Saurabh

    Thank you for this. I will start with the preload suggestion, and then move to the Cloudflare area (it must have been chosen by the host because it is not something I specifically opted for). Do you happen to know of any plugins that work with Cloudflare?

    David

    Thread Starter westham60

    (@westham60)

    Thank you for this information. Very impressed by the speed and usefulness of your responses.

    Thread Starter westham60

    (@westham60)

    Thanks Amir for your quick reply.

    I can confirm that disabling the Views Column in Content List does allow the post/page lists to be displayed instantly. And no, that plugin is not used.

    Thread Starter westham60

    (@westham60)

    Thanks.

    Yes, it is with a managed provider, so that is a good idea. And thank you for that reassurance as the IP address of the request was from Romania – not necessarily an encouraging sign.

    Thread Starter westham60

    (@westham60)

    Nothing that is identified as an error (unless I’m not looking in the right place). There is one Issue, which would seem not to be relevant: Cookie sent in cross-site context will be blocked in future Chrome versions

    Thread Starter westham60

    (@westham60)

    I was wrong – something is causing certain posts to be shown on successive pages and others to not be shown at all.

    Thread Starter westham60

    (@westham60)

    I worked out that the problem was to do with offset, and even found code and advice that should have solved everything on an external site titled “Changing the posts per page on first page without breaking pagination in WordPress” (I am not going to include its URL) as the code simply doesn’t do what heading says.

    However, I could follow the code, so went old school with pen and paper, and did some simple arithmetic with the code formulas to get the post ranges that I wanted, i.e. posts 1-8 on homepage, 9-32 on page 1, 33-56 on page 2 and so on. I made the adjustments to offset and posts_per_page, and it works.

    Thread Starter westham60

    (@westham60)

    Or at least I thought it did the trick perfectly but the paged() version of this seems to have an anomaly, in that /page/2 bypasses the next 24 posts after the most recent ones on the homepage. Perhaps I’ve done something wrong – here is the code:

    function pages_pagesize( $query ) {
    if ( ! is_admin() && $query->is_main_query() && is_paged() ) 
    {
    // Display 24 posts for search pages
    $query->set( 'posts_per_page', 24 );
    return;
    }
    }
    add_action( 'pre_get_posts', 'pages_pagesize', 1 );

    So just to clarify, the homepage shows the most recent 8 posts, but clicking on the page 2 link doesn’t show the next 24 posts (9-32), but rather the 24 after that (33-56). The problem only occurs with the paged() version, the search() and archive() are fine.

    • This reply was modified 2 years, 1 month ago by westham60.
    Thread Starter westham60

    (@westham60)

    bcworkz, thank you so much. This did the trick perfectly.

    For anyone else needing this solution, I used the following code for archives (category, tag, author, date), is_search() for search pages and is_paged() for the main pages off the home page (e.g. …com/page/2):

    function archive_pagesize( $query ) {
    if ( ! is_admin() && $query->is_main_query() && is_archive() ) {
    // Display 24 posts for archives
    $query->set( 'posts_per_page', 24 );
    return;
    }
    }
    add_action( 'pre_get_posts', 'archive_pagesize', 1 );
    • This reply was modified 2 years, 1 month ago by bcworkz. Reason: code format fixed
    Thread Starter westham60

    (@westham60)

    bcworkz, thank you for your idea. I certainly hadn’t thought of a CSS solution, but unless I’ve missed something, it doesn’t address the problem of the number of posts per page on the archive pages.

    Indeed, having reflected on this for another day or so, it is not the grid that is the problem requiring a list as solution, it is the number of posts on the archive pages. I’m quite happy with the existing grid appearance, I just would like to be able to display more rows (5 or 6) on the archive pages, but not on the homepage.

Viewing 12 replies - 1 through 12 (of 12 total)