Page 1 of 1

Wordpress: How to paginate a list generated by PHP?

Posted: Mon Sep 06, 2010 6:37 pm
by braaad
'm using a Wordpress plug-in called WP Calendar to display a list of events. It's a plug-in that I activated in the admin and then added the PHP code below to my template file. Currently, the plug-in is set to display 20 events, however, I need to display 100+ events so I would like to paginate this list. Does anyone here have any pointers or links to tutorials on how to do this? Thank you!

Code: Select all

<?php fse_print_events_list(
  array( 'number'   => 20,
         'before'   => '<div class="calendar">',
         'after'    => '</div>',
         'template' => '<h1>{event_startdate}</h1><h3>{event_subject}</h3><p>{event_description}</p><br />'
  )
);

?>

Re: Wordpress: How to paginate a list generated by PHP?

Posted: Mon Sep 06, 2010 8:37 pm
by Jonah Bron

Re: Wordpress: How to paginate a list generated by PHP?

Posted: Mon Sep 06, 2010 10:11 pm
by braaad
Thanks for the link. I read through it thoroughly, tried to hack it to my needs and utterly failed :roll:

Re: Wordpress: How to paginate a list generated by PHP?

Posted: Tue Sep 07, 2010 11:45 am
by Jonah Bron
What doesn't work? Do you get an error?

BTW, in programming, failure is not an option. :)

Re: Wordpress: How to paginate a list generated by PHP?

Posted: Tue Sep 07, 2010 1:47 pm
by braaad
Ha ha, that's a great attitude! Well, since you asked, I have to admit it's basically my lack PHP coding fundamentals other than cutting'n'pasting, plugging in some values into an array, and basically stumbling around trial'n'error style till it works. The link you posted is great but honestly it's a bit over my head- I don't even know where to start.

It's kind of like someone asking how to make a wedding cake but they've only made cupcakes... using a Barbie oven. I was hoping there was ab easily modifiable bit of code that I could hack into what I have, but this isn't the case. I will probably end up hiring someone to do it. Are you available? 8)

Re: Wordpress: How to paginate a list generated by PHP?

Posted: Tue Sep 07, 2010 4:37 pm
by Jonah Bron
Actually, a quick and easy alternative would be to change the little bit of code to make the div.calendar have a fixed height and set the overflow to scroll. Then just change the 'number' to 100+ or whatever you want.

Just insert this CSS into the calendar class:

Code: Select all

height: 300;
overflow: scroll-y;
If you're really bent on pagination and can't do it yourself, yes I'm available.

Re: Wordpress: How to paginate a list generated by PHP?

Posted: Tue Sep 07, 2010 11:47 pm
by braaad
Nice work-around! Going to present it to the client and see what they think. If they're not into it, I'll PM you regarding your rates. Thank you Jonah!