scriptygoddess

23 Jan, 2005

wpPaginate (for WP 1.5)

Posted by: Jennifer In: WordPress Plugins

I know this has been asked for some time. You can thank the snow storm we got here in the northeast, that made me stick around long enough to get it done.

I've updated my wpPaginate plugin to work with WP 1.5. I got a lot of inspiration from the Custom Posts Per Page plugin (and my plugin should work in conjunction with that one).

Current Version: v. .2.2
Last Updated: 1/25/04 9:30 PM EST

Download and install this plugin
(Same as always: right-click and save that file with a .php extension. Make sure you do not have any spaces before the first <?php or after the last ?> in your copy. These spaces will cause "cannot modify header…" type errors.

Instructions.

optional: adjust settings where noted in the plugin.

1) upload plugin file to your wp-content/plugins directory.

2) activate through admin control panel

3) where you want to show paginated navigation do the following:

<? print_pg_navigation() ?>

optional: you can pass two strings to print_pg_navigation. The first string is what will appear BEFORE the page navigation. The second string is what will appear AFTER the page navigation. NOTHING will be displayed if no navigation is appearing on the page. So, when there is navigation, if you wanted to have the navigation surrounded by <p> tags, you would do the following:

<? print_pg_navigation('<p>','</p>'); ?>

Consider this basically a "beta" version. I've tested it on a test site, but that's about it.

IMPORTANT UPGRADE INFORMATION:
If you still have the code from the original wpPaginate version – make sure you REMOVE the "wpPaginate()" function call in your templates/themes. You no longer need to call that function, and it will actually cause problems if you do.

Change Log
new in ver .2.2
bug fixes.

new in ver .2.1
lotsa little bug fixes. Also fixed some issues so it runs faster.

31 Responses to "wpPaginate (for WP 1.5)"

1 | Jack

January 23rd, 2005 at 7:40 pm

Avatar

HA, that's fast! Thanks very much! Just asked about it a few days ago ;-). And all thanks to the rough weather (which I only saw on television).

It seems to work fine with my site too. I'm happy to have it back on my pages :)

http://www.spoenk.nl/weblog/?cat=5&paged=1

2 | Jennifer

January 23rd, 2005 at 10:16 pm

Avatar

Fixed some issues I noticed. Updated to v. .2.1

3 | Ronnie D

January 24th, 2005 at 8:40 am

Avatar

That's strange: v.2 of the plugin worked well, apart from on the category page where it would say "invalid argument supplied for foreach()" in the wp-includes/template-functions-category.php file, at the top of each category archive page.

In v.2.1 this message is gone, but the plugin doesn't return anything! I haven't changed any of the default settings within the plugin file.

Any ideas? Many thanks for your hard work, Jennifer.

4 | Joen

January 24th, 2005 at 11:09 am

Avatar

Huge thanks for this plugin! I was a great fan of the 1.2 version, and was very sorry to let it go when I updated to 1.5, so glad to see you're focusing on 1.5 also now.

Unfortunately, I can't get it to work. The problem seems the same as the above poster: pages work, but there's no pagination-navigation.

5 | Jennifer

January 24th, 2005 at 11:14 am

Avatar

I'm working on the issue and will update the plugin when it's ready.

6 | Jennifer

January 25th, 2005 at 10:36 pm

Avatar

Ok, give it another try. Updated to ver .2.2. Category error page should be gone. (and the rest of the functionality should be back too. heh)

7 | Ronnie D

January 26th, 2005 at 7:30 am

Avatar

Great stuff! It looks like all the problems have been resolved…. many thanks.

8 | Joen

January 26th, 2005 at 8:21 am

Avatar

Jennifer,

It's much better now, though still fairly buggy, specifically when it comes to WP 1.5 Themes and Pages.

What happens on my site (I've deactivated it again), is that on date archives, category archives and pages, the various functions described by Ryan Boren such as is_page() or is_archive() seem to stop working. This concretely results in my sidebar (which is a template file) shows items that are not supposed to be on all pages.

One example is "if (!is_archive()) { [show playlist] }". Hope this helps, thanks for your work, and if you need more help, you can contact me.

9 | Jennifer

January 26th, 2005 at 9:13 am

Avatar

I tested it out using the (now) default Kubrik them. I'll take a look at the specific functions you're talking about, though.

10 | Jennifer

January 27th, 2005 at 10:04 am

Avatar

The fix to Joen's problem: make sure you are not still calling the wpPaginate() function like you did in the previous wpPagainte plugin version. There's no need to do that anymore (and will cause problems if you do). I'll update the post to reflect that as well…

11 | Dmitri Von Klein

February 7th, 2005 at 6:07 pm

Avatar

First of all I'd like to thank you for your work on this plugin it's excellent. I've been using it in 1.2.2

However recently I've been converting to 1.5 02-07-05 built and I got everything worked out, got the new plugin version.

Yet for some reason the frontpage takes a really long time to load, archives, search, singles are all fine. When I turn off paginate it loads fine.

stable: 1.2.2
test site: 1.5

I'm simply trying to mimic what I have in 1.2.2 in 1.5

12 | Jennifer

February 8th, 2005 at 8:47 am

Avatar

Dmitri – I opened both those links at the same time (in different browser windows) – and they loaded in at the same time?? Is the plugin not running?

13 | Jamie

February 12th, 2005 at 9:26 am

Avatar

Jennifer, thanks so much for writing this plugin. I was definitely missing the MTPaginate plugin with MT! I saw that you asked in the previous WPPaginate post if anyone would be interested in a "View All" function. I am definitely interested. Right now the code View All doesn't quite work the way I thought it would. It doesn't view posts for that particular category (I'm using WPPaginate for Category pagination).

Here is how my MT implementation makes use of the MTPaginate plug-in. Is this possible with WPPaginate?

http://www.asianmack.com/archives/cat_alternative.html

Again, any advice would be much appreciated. Thanks again!

14 | Eric

February 13th, 2005 at 3:06 pm

Avatar

Any chance of making something like this for comments? I have a post that is sitting at 93 comments and is likely to continually grow, so it'd be nice to split them up on a custom amount per page.

15 | Jamie

February 15th, 2005 at 11:28 am

Avatar

Jennifer, I wanted to also followup on my tweaking of WPPaginate for my working WP installl. Here's the same version of the category page with an early implementation of the WPPaginate plugin.

http://www.asianmack.com/wordpress/index.php?cat=2

16 | Jennifer

February 15th, 2005 at 11:17 pm

Avatar

I did not actually incorporate the "view all" functionality in the latest version… I will have to add it to the to do list. I'll be honest though – between full time job and freelance work – I don't have much time to do side projects like this these days. I wish I did…

17 | Alderete

February 16th, 2005 at 4:12 am

Avatar

Just a quick suggestion for your page for this project. Some of us have never used the MT plug-in which apparently inspired this one. So, I have no idea what it actually does. Doesn't WP 1.5 already have paging built-in? (Not the static pages, but paging through an article.) How is this different?

18 | Tec

February 21st, 2005 at 10:12 am

Avatar

Jennifer, great job on this plugin! was wondering though if it's possible to make the pages only appear in the archives page and not on the index page itself.

19 | Jennifer

February 21st, 2005 at 10:18 am

Avatar

Not 100% sure what you're asking – but if you're referring to the pagination nav – look at the settings in the plugin file itself to edit which pages it will show up on.

20 | Alan

February 21st, 2005 at 8:54 pm

Avatar

Thanks for this plugin. Brill'! :)

21 | spiceee

February 24th, 2005 at 10:36 pm

Avatar

word to the wise:

please remind to delete the old rules in your .htaccess file (if using clean urls in permalinks), or at least the ones refering to category pages.

when upgrading to 1.5, wordpress will add/append the new rules to your .htaccess but apache will match the url to your old category rule that doesn't know anything about the new paged result sets…

22 | Cara

March 17th, 2005 at 10:10 am

Avatar

Hi Jennifer, thanks for the code.
However, when i navigate the last page at my weblog, i found out that it never shows all the posts. Any idea?

23 | Cara

March 17th, 2005 at 10:27 am

Avatar

Nevermind about my last post.

I found out that the problem is due to the conflicts between this plugin and the Category Visibility Plugin by Gudlyf's World.

I have point out this at Gudlyf's weblog.

24 | Andrew

March 17th, 2005 at 7:54 pm

Avatar

Thanks for the plugin, its been helpful in the past. However, using the new version in WP 1.5, I often get more pages than I have posts for! For example, my March 05 archives have only 2 pages worth of posts, but I get links for 5 pages. This is also true if I use the page links on the home page. I get 32 page links, but only have about 20 something pages worth of posts.

What's weird, is that not all archives and category pages have this problem. Some print the exact number of page links needed.

I've tried disabling all other plugins and changing back to the default themes/template, but I still get more page links than necessary.

Hope someone knows what's going on.

25 | Jennifer

March 17th, 2005 at 9:49 pm

Avatar

Andrew – I'm going on vacation soon – but I'll email you when I can. Since I had this working on a base WP install – I'm thinking it's probably a plugin conflict. In the meantime, if you want to try turning on and off other plugins to narrow down which one it might (or if that's the problem to begin with) that would get a jump on things….

26 | Edrei

April 20th, 2005 at 8:57 am

Avatar

There seems to be a problem with the Paginate. For some reason it would show links that don't exists. My entire site shows up to 90 pages but the paginate displays 112. Same goes for my archives, it displays more pages than actually exists.

Is there a fix to this?

27 | Junap

April 23rd, 2005 at 8:32 am

Avatar

very handy plugin :)

Just wondering if you have (or know of) a plugin that provides similar functionality for paginating long lists of comments within each post?

28 | Bertrand

April 26th, 2005 at 4:40 am

Avatar

Hello goddess, thank you very much for this simple functionality, but it works great on my side and let peope be aware there is much more to read.

29 | Francesca

April 26th, 2005 at 11:58 am

Avatar

hello :)
this plugin is just what I was looking for. But I encountered a problem because the page that needs to be paginated is called news.php and not index.php.
And when one of the pagination number is clicked, the URL is: http://www.domain.it/news.php/index.php?paged=2 and it's not correct. Can you help? Thanx :)

30 | yk

April 30th, 2005 at 11:28 pm

Avatar

If you for some reason like me want a divider only between 2 page numbers, eg 1 … 2 | 3 | 4 … 10, change line 105

"if ($i != 1) {"

to

"if (($i > ($lowtest + 1) || $lowtest == 1) && ($i < ($hightest) || $hightest == $num_of_pages) && $i != 1 ) {"

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements