WordPress.org

Ready to get started?Download WordPress

Forums

Live Data Feed for Sports events (7 posts)

  1. fuocorav
    Member
    Posted 9 years ago #

    Hello, I'm a technology specialist here at school for the Deaf in southern CA. I decided to go with WP for basketball touranment...instead of using boring static HTML pages. Basically, we will blog the happenings for basketball tourament for the Deaf involving 8 school teams. It's a FIRST in this school...the concept of blogging is still new and strange to several staff here.

    Now, I already searched for the best "real time" live score feeding...my original plan is to have a seperate static webpage for live scores..then I cannot find solid software that enables me to type scores and upload the scores in the webpage.

    I thought since most plug-ins are using Amazon, del.icio.us, feedsters, rss feeds...can someone develop a simple plugin to be embedded into list style menu. (I'm no programmer..but digs WP).

    So I can login in WP and type score...press the button "refresh" then the score will be refreshed.

    For example, team A vs team B...so I can type team A 50 team B 49 and it shows up in the list box on the sidebar. As well as for Team C vs Team D, etc.

    Various live scores in one list box.

    Any help would be appericated and I bet it will be a useful feature for schools.

    Rene V.

  2. Kafkaesqui

    Posted 9 years ago #

    Something like this already exists in WordPress in raw form.

    When editing a post (or when composing a new post and you're set for Advanced controls under Options > Writing) focusing on a game, you can create two custom fields, one for each team using the key for team name and value for their score. Then to update the scores, edit these fields in the post and save your changes.

    Now, to display these with the post, insert the_meta() tag into your WordPress template:

    http://codex.wordpress.org/Template_Tags/the_meta

    Place it somewhere in The Loop portion of the template.

    There are also some plugins out there that allow more control over displaying meta/custom field data:

    http://codex.wordpress.org/Plugins/Meta

  3. fuocorav
    Member
    Posted 9 years ago #

    Hey, thanks for your helpful reply. I'm afraid posting live scores in posts is not a good idea because I plan to have student blogging the developments at the event so the live score post will be pushed down with the newer entries/posts.

    I prefer to put the live scores in a category and list menu so a visiter can view the live scores on the right column instead of in the post.

    I'm not tech-savvy, but I can learn fast. Is it possible to create custom fields in links menu to reflect live scores?

    Thanks,

    Rene V.

  4. Kafkaesqui

    Posted 9 years ago #

    Custom fields are tied to posts (and Pages in 1.5), so it'd be hard to assign them independent of these.

    This is all stretching the intention of custom fields, but with an existing Page, you could edit the custom fields for teams/scores in this, and with a bit of php could pull in the data to your sidebar. The following would go into your theme's sidebar.php or #menu section, or where you want the scores to appear:

    <?php
    $page_id = 100; // Set this to Page ID #.

    $scores = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = $page_id ORDER BY meta_id");
    if($scores) {
    foreach($scores as $score) {
    $team = $score->meta_key;
    $points = $score->meta_value;
    if(is_numeric($points)) {
    if(!$game) {
    echo "<ul class="scores">n";
    }
    echo "<li>$team: $points</li>n";
    $game++;
    if(2 == $game) {
    echo "</ul>n";
    $game = 0;
    }

    }
    }
    }
    ?>

    The script verifies the value field is a number (i.e. score), so you could prep the team listings and not have them display; or you can place 0 (zero) as the score to "initialize" and display them. The teams are ordered by entry (meta_id table value), so should show up together (So Team A vs. Team B are the first custom fields, Team C vs. Team D are next, and so on).

    Note that I slipped in a 'scores' class for each game <ul>, so you could style the output in your css.

  5. fuocorav
    Member
    Posted 9 years ago #

    Hello,

    I did copy and paste the PHP code with two custom fields: Riverside Boys and Fremont Boys and it's not appearing..However...the link from the Post go directly on the Page. the page id is 10. So, I already set up two custom fields for teams and set up a page for Live Scores.

    I'm using WordPress 1.5 default theme and added your PHP code into sidebar template inside the

      .

      Do I need to insert meta tag?

      Am I missing anything? I'm still naive to PHP coding.

      http://www.lightkitchen.com/blog/

      I'm setting up a live score in

      http://www.lightkitchen.com/blog/?p=10

      I'm using my personal website to test blog and live scores.

      Would it be easier if you send me the entire sidebar template with default WP links with your added code so I can figure it out?

      Thanks for your effort!!!

      Rene V.

  6. fuocorav
    Member
    Posted 9 years ago #

    http://desto.net/andrew/content/newsticker2/newsTicker.html

    that's a good example of what I want in WP. Can you use the PHP page to flesh out the javascript and html within

      menu?

      Or just below the header (header image)?

  7. maestro42
    Member
    Posted 9 years ago #

    I ran a basketball tournament this past christmas. You can view the site here. For the live scores "scoreboard" I simply used an IFRAME and had a separate html page with a simple little scoreboard table that I had my staff update using FrontPage. It worked out really well.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.