Fixing the Archive Problem
 

The theme that this theme is based on, “Oceans Mist” had a number of problems that I wont go into.. however one of the biggies was its inability to correctly display archives.

Basically if you had any more than 10 items (or however many you have your WP set up to display in the admin area) they just wouldn’t show up. There was no way to page back through those archives. This is lame, and I’m fixing it.

I have no idea if this is an issue with other WordPress Themes, but it certainly was with this one. This fix will happen mostly through a very simple use of Ajax. The main reason is that there is no way to easily pass this information to the PHP with an HTTP/GET that satisfies all problems. AND, do it in such a way as to not have to edit the core code of wordpress.

Thus, a very simple ajax object will now live in the theme to facilitate this change. Soon when you go to an archive you will see an enumeration at the top and bottom of the listing similar to any other pagination system.

Eg: << < 5 6 7 8 > >>

Each page will display a fixed number of items.. I’ll see if I can pull that out of the config for wordpress but I may just default to 10 or something..

Most of the ajax code and server side code is in place to handle the call, however right now the JS object doesn’t know what to do with the response.

Also, I have fixed the template to correctly use engine logic as opposed to cheating and grabbing information directly from the URL. This means that no matter what your permalink structure, it will correctly know where you are and what you want to display.

EDIT: After looking at the other templates it seems the “correct” way to do this is to use the “next_posts_link” and “previous_posts_link” which will correctly set the HTTP/GET depending on your permalink structure.. However, I still like the pagination system so I’m going to go ahead and move forward with that. 

I am going to dig a little deeper into the default and classic themes that come with WP just to get a better idea how things should have been done.  So if you show up and suddenly the site is in “classic” or “default” theme then that’s why.

I’m also going to explore ways of making a real time theme switcher and more themes..

Related posts

Permalink -- Trackback

 
Jason

Okay I have fixed the theme to use the “next/previous post” tag provided by WordPress if you don’t have my Desired Functions plugin installed.

If it is installed, then it will use the new system (which I haven’t finished yet.)

 
Jason

Okay, I completely changed the way I was going to do it after all..

I figured out how to do it using the boards custom tags so I don’t have to use AJAX.. Too bad.. heh

If you have my plugin you will see a pagination system similar to a forum. It will have a Next and Previous button at either end, with the page count in the middle.

It only shows 3 pages either side of the page you’re on however thats easily customizable. It also shows the first and last possible page assuming you’re not in range of it.

So, Without my plugin you see this:

« Prev :: Next »

With my plugin you see something akin to this;

« 1 … 3 4 5 6 7 … 12 »

 
Leave a comment