jacotheron — 2012-01-13T03:18:38-05:00 — #1
Hi All, hope you had a great holiday.
I have created a WP plugin that requests Twitter timelines and Facebook statuses and mix them together with your WordPress posts (support custom post types) and then display them in reverse chronological order.
On the client website (for whom I created the plugin, viewable at http://projects.starsites.co.za/Shimmer/) I also use jQuery tabs to have a tab for All, Facebook, Twitter and WordPress separately. The plugin works by having a Shortcode where I can set which sources to use and output, it then fetches the information from Facebook and Twitter and WordPress, cache the fetched info for 5 minutes (to be used for next few hits; stored as a serialized array in a file) before having to fetch it again. Next the information gets parsed and handled according to the source and convert the date to the correct formats. For both Twitter and Facebook their respective API are used to fetch the data.
Now my 2 Questions where I need help:
- On the first page load in a while (to clear the cache), only the "all" tab's shortcode gets executed and returned, but a page refresh (with an active cache) all tabs are populated. How should I fix this? Is it because the Facebook might take a little bit longer to fetch the data?
- How would I go about paging the timeline results? Currently a very long list is displayed. Basically I want to know which name for the paged variable should I use, that will not clash with built-in functionality, but will bot be stripped by WordPress
Any help will be greatly appreciated.
The plugin I created needs a few other fixes and modification before it will be released on the WP Plugin Repository for all to use. The plugin also allow external functions to handle how which data source should be displayed.
Starsites - Web Systems
jacotheron — 2012-01-13T09:27:29-05:00 — #2
I have solved the 1st problem:
It appears that Wordpress executes so fast, that between the shortcodes, literally no time passes and thus the cache is 0 seconds old. Modified it to allow <= 0 and now it works.
rguy84 — 2012-01-13T10:30:13-05:00 — #3
Re Question 1: You could use the setTimeout() function.
Re Question 2: Pagnation causes heartache at times, couldn't you just grab the last 5-10 and include a link to their profile?
jacotheron — 2012-01-13T16:58:13-05:00 — #4
Q1: I have now fixed it to populate all the tabs, but will for the plugin take a look at the timeout function to prevent it from taking too long.
Q2: That makes a lot more sense and will be a lot easier.