SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pretoria, South Africa
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Facebook/Twitter/WordPress Plugin: Shortcode executed only once & Paging the results

    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:
    1. 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?
    2. 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.

    Jacotheron
    Starsites - Web Systems

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pretoria, South Africa
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    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?
    Ryan B | My Blog | Twitter

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pretoria, South Africa
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi @rguy84
    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.

    Thank you
    Jacotheron


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •