WordPress.org

Ready to get started?Download WordPress

Forums

How to store data for my plugin? (8 posts)

  1. drtanz
    Member
    Posted 1 year ago #

    I am building an RSS reader plugin and I'd like some advice on how to store the data and settings for this plugin.

    The idea is to be able to enter a set of feed sources and associate each one of these sources with one or more categories. Thus you can have several categories e.g. sports, politics each having their own associated feed sources.

    So for example:

    Sports
    ESPN.com
    Sportingnews.com
    When the feed items from these feed sources are imported every few hours via Cron they are then stored as custom post types. Each feed item must of course be associated with the feed source.

    When it comes to display feed items the plugin will use this logic:

    Check which category is being called (via shortcode)
    Check which feed sources are associated with that category
    Get feed items associated with feed sources identified in step 2
    I am still unsure about how all this data needs to be stored.

    The plugin will have a settings page and for that I am settled about storing everything in the wp_options table.

    However when it comes to the feed sources, categories and feed items, I'm still confused how to store them best.

    Any suggestions on how to do this?

    I've been reading about the CPTonomies plugin which seems to do what I need, but I want the functionality in built into this plugin and I cannot use another external plugin.

  2. s_ha_dum
    Member
    Posted 1 year ago #

    I don't understand why you are storing them as custom post types. That is a fair bit of work for what sounds like temporary storage. You are updating every few hours. I'd use the Transient's API instead.

    Unless, what you are doing is scraping, in which case I'm out.

    If you do have a legit reason to be storing as a custom post type, put the feed item associations in wp_postmeta. There are functions for that too.

  3. drtanz
    Member
    Posted 1 year ago #

    I think it would be more efficient to use CPTs, also giving me an interface for the user to view his feeds, and even add to them, for example his own comment after a feed excerpt. The idea is definitely not to scrape, but to act like a normal aggregator.

  4. s_ha_dum
    Member
    Posted 1 year ago #

    You want this to be something like Digg, or Newsvine or something, where people can comment on content from other sites? I guess you do need custom post post types for that. The answer to your original question is wp_postmeta, as above.

  5. drtanz
    Member
    Posted 1 year ago #

    There is no need for people to be able to comment. I still cannot see how associations between the data as described can be done via wp_postmeta.

  6. s_ha_dum
    Member
    Posted 1 year ago #

    There is no need for people to be able to comment.

    You mentioned adding a comment after a feed excerpt.

    I still cannot see how associations between the data as described can be done via wp_postmeta.

    Then describe your project in more detail. I must not be understanding you.

  7. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    As they closed your duplicate post, I will repost my thoughts here also:

    Each Competition would be a Page. That page would load a custom page template that would use a combination of HTML and custom queries to output data in the manner desired (and some CSS work also).

    Each Team is given it's own category which of course would be the team name. Each category would have it's own custom template (Team logo, output list of players, etc.)

    Each Player has a post in the team category. Using the permalink structure /%category%/%postname%/ would make their url to be sportsite.com/team/player (which would work well for SEO). If a player is added or removed from said Team category, the well written custom queries used would then not display them in the lists(s).

    Once above is all created, it's a matter of site flow and design (custom queries, those page templates, custom css).

    Assuming yearly competitions, I would set up WP Multisite per year sportsite.com/year/, first year of course requiring much work, but the subsequent years would start with a copy of the previous year db, and an import of pages and posts to start.

    If done well with CSS, each year could easily provide a fresh look by simple edits to the stylesheet.

  8. drtanz
    Member
    Posted 1 year ago #

    @Seacoast Thanks, I had actually tried explaining my issue via another example in the other post. I still don't have a proper answer for how to organise data for this RSS plugin I'm building.

    Probably going to spend some time analysing the Posts to Posts plugin to see whether I can adapt some code from it.

Topic Closed

This topic has been closed to new replies.

About this Topic