Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am currently building a sports betting website, and have problems creating database tables for tipsters who writes sports picks. All the picks should be stored in a database table, with information about the pick, result, statistic etc. Very similar to the tables seen at betshoot.com, betrush.com etc.

Can this be done by using custom posts or a specific plugin?

share|improve this question

1 Answer 1

This can be achieved by creating a custom post type called for example, sports_picks

Custom Post Types can also be extended with the use of Custom Fields and Custom MetaBoxes which means you're not limited to using Title and Description input fields only, but instead you're able to create a Post Type that meets your exact requirements as shown in your provided links.

While there are plugins that can help you with Custom Post Types and Custom Fields (i.e. Advanced Custom Fields Plugin) I prefer to advocate the developmental, hands on approach.

Here are some links to resources to help you get started;

  • Custom Post Types - LINK
  • Custom MetaBoxes - LINK
  • Custom MetaBox Helper Class LINK
  • Another Custom MetaBox Helper Class LINK

As an example, to create a custom post type called sports_picks you would put something like this into your functions.php file;

add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'sports_picks',
        array(
            'labels' => array(
                'name' => __( 'Sports Picks' ),
                'singular_name' => __( 'Sports Pick' )
            ),
        'public' => true,
        'has_archive' => true,
        )
    );
}

Note: This is a basic custom post type template, in-fact taken directly from the WordPress codex located HERE and custom post types accept many more customizable parameters than those simply listed above - but that will get you rolling along with the supplied links above.

Once you have your custom post type created you will want to go about creating some Custom MetaBoxes so you can accept more input fields and types that closely match your niche of sports betting.

If all of this is too daunting for you (i.e. you have no coding experience and don't wish to venture down this path) then you can opt for a total plugin solution. Running a search on Google or directly within the WordPress plugin repository will give you a good deal of resources/plugins to use for setting up and controlling your custom post types and for custom fields I would suggest using the Advanced Custom Fields plugin. There are other plugins that handle Custom Fields too however so don't feel that you have to use ACF, it's just commonly suggested for people looking for a plugin of that type.

If you experience any difficulties with adding the code snippets above or within the links provided to your themes functions.php file - do post back describing your issue and I'll provide some more help where applicable.

share|improve this answer
    
Thank you very much for the answer. I may try out the plugin first, as my coding experience is very limited. Will this solution be able to keep track of the statistics for each tipster, i.e how many bets won/lost after the game is settled? The result will be added manually after the game, but should be included in a formula to update the statistics to the tipster. –  Kent Apr 22 '12 at 17:01
    
The functionality of your custom post type is dependent on the logic you create for it. Creating a custom post type with custom fields will enable you to store the kind of data you need to meet your needs but keep in mind that if you are manually entering data a.k.a "picks" then you will need to also manually enter the result of the match/game too. Of course you can achieve this programatically (in an automated fashion) but that will require that you hire someone to code that logic for you because you are dealing with unique data sets. There's no way for your CPT to know the result otherwise. –  userabuser Apr 22 '12 at 17:07
    
Ok, this might be over my head. I will work with the other aspects of the website for a while, and then figure out how to do this later. But I really appreciate your answer, and will keep it for further reference. I wish I could just put some of the brilliant people here in a box, and use your knowledge whenever I need it. :) –  Kent Apr 22 '12 at 19:03
    
I'd be happy to help you wrap your head around the best way to approach a solution, considering that your requirements are on the advanced side of things its possible that your CPT + programmatic structure needs some fleshing-out. Since the Question & Answer threads are not a place to hold a prolonged discussion of this type, if you feel inclined, make your way over to the StopPress chat-room accessible on the home-page in the sidebar and I can provide you with further information. Best of luck in the meantime. –  userabuser Apr 22 '12 at 19:18
    
Thanks, I´ll just work up my reputation first, seems like I need 20 points or something to be able to use the chat. –  Kent Apr 23 '12 at 15:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.