Jonnie Grieve Digital Media: Blog

Home
by on 23rd February, 2021 - 4:34pm (0)

Blog: R6D69: #100DaysOfCode (More Posts)

As you can see, Pagination now works in this blog, and (currently) allows you to click and view every blog post available.  As you can imagine if you’ve been following the blog this took some time to get right but it’s a relief that it now is.

Here’s how I now rationalise who I’ve got to where I am now.

  • Consider the total number of posts that you’re trying to retrieve.
  • posts_per_page() as per your template file  is the number of posts displayed in a given page in your pagination and overrides the value stored in the Reading Settings: “Blog pages show at most” of the admin area
  • This setting does what it says on the tin.  Assuming it is not changed in code it value changes the number of total posts displayed by WordPress and by default it is 10.

So this finally is definite progress.

I also took the time to do some minor styling changes and consider the next part of my work to enhance the blog; Making a working search page.  Since day 1 there have been issues with this with the same results being returned and the same number, no matter what is being searched. Clearly, that is an issue that needs to be addressed.

By the time I’m finished fixing this I’d like to be able to

  • Return the search term that was searched by the user
  • Return the correct count of results sent back as an integer.
  • Return the correct results as a structured list.
  • Allow the user to make a new search from the search result page.

This post has been assigned to the following categories

    Leave a Reply

    Your email address will not be published. Required fields are marked *