• I am part way through trying to rebuild my website and upgrading many years of blog posts – using 2024 theme.

    I have made the following page, which seems to be quite a nice vehicle to cater for random browsing.

    I have a few hundred posts and would ideally like the current number to load all on one continuous page – or at least have a ‘next batch’ button at the bottom. Loads fast enough here at least – to accommodate more

    Appreciate any suggestions how that might be achieved.

    And also – would there be a way for me to give users the option to resort according to date – or reverse day – or as it stands now, alphabetical

    I forgot to say that the dialog box for adjusting prefs for the ‘latest posts’ widget thing has a slider which permits up to 100 – and is unresponsive if one types anything more than that in box.

    Perhaps there is a way to hack the widget code or overcome the limitation some other way?

    Many thanks

    • This topic was modified 3 weeks, 3 days ago by Philip Chudy.
    • This topic was modified 3 weeks, 3 days ago by Philip Chudy.
    • This topic was modified 3 weeks, 3 days ago by James Huff. Reason: redundant link removed

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Use the “pre_get_posts” action hook to set the “posts_per_page” value to the desired number. Setting to -1 will list all posts. If you have a huge amount of posts, using -1 is ill advised. This action affects all posts queries. You should only apply this to main admin queries.

    Thread Starter Philip Chudy

    (@philipchudy)

    thanks for the reply

    I tried to find pre_get_posts in the function.php file in wp-content/themes (this is 2024) but nothing like that is in that file

    Where else might I find it? – thanks

    According to google appearance should have a Theme File Editor – but I does not in my dashboard

    • This reply was modified 6 days, 16 hours ago by Philip Chudy.
    Moderator bcworkz

    (@bcworkz)

    The pre_get_posts doc page is here. You’ll find some useful examples there. There’s a source code listing there as well, but I don’t find it very informative out of context like it is. However, right below the source listing are links to its place in full source code on Trac and GitHub, which gives us the full context.

    If you prefer to look at it in your own installation, it’s applied in /wp-includes/class-wp-query.php. Line 1881 in v6.7

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.