WordPress : custom table

I use WordPress to make a website for my University and I have to implement a special page that presents the applications developed by the students.

I’d like to make a special table called ‘application’ with different field like the name of an application, its description, link to store, icon, screenshots, etc. I should implement these different kind of pages: one page that lists all the applications (with the listing of the name & icon of each application), one page that presents one application, and moreover and administration of the application (add / edit / delete an application from the database).

Read More

I searched a lot on the net and I found this tutorial : http://wp.tutsplus.com/tutorials/plugins/custom-database-tables-creating-the-table/ but according to the author, it is a rather complex manipulation.

Does there exist plugins according to you that allows me to do that ? My main worries are the gestion of the forms to add / edit an application…

PS : What I’m asking is just 2-3 lines of how you would implement this, I do not need explanations of one page that will take one hour for you to write 😀

Related posts

Leave a Reply

2 comments

  1. I think you don’t have to create a separate table.
    According to my opinion the plugin types
    1: http://wordpress.org/plugins/types/ is suitable for you.

    create a post type application and
    create custom fields like link to store, icon, screenshots, etc

    and description will be your content added with its editor i.e tinymce

    for different template create custom template for your custom post type use Post type template
    and for edit ,delete, update you can use code

        <?php edit_post_link( __( 'Edit', 'mytheme' ), '<span class="edit-link">', '</span>' ); ?>
    

    the edit link will be visible if your are logged in as administrator

  2. Well, I would like to do it using a custom post, like this (it’ll give you WordPress’ standard add/edit/delete option for the custom post and saves lots of work too)

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
        register_post_type( 'university_apps',
            array(
                'labels' => array(
                    'name' => __( 'Applications' ),
                    'singular_name' => __( 'Application' )
                 ),
                 'public' => true,
                 'has_archive' => true,
            )
        );
    }
    

    But, a custom post has only WordPress standard fields, such as, Title, Content etc and this is not enough for you to achieve the goal you mentioned but you can use custom fields for this, which means, you can add more (custom) fields to save your application’s url, description, icon etc. to, do this, you can use add_meta_box, like (also check this tutorial)

    function add_custom_meta_box() {  
        add_meta_box(  
            'custom_meta_box', // id  
            'Custom Meta Box', // title   
            'show_custom_meta_box', // callback  
            'university_apps', // post type
            'normal', // context  
            'high' // priority  
        ); 
    }  
    add_action('add_meta_boxes', 'add_custom_meta_box');
    

    Also, you can check Adding Custom Fields to a Custom Post Type, the Right Way, a nice article, to add custom fields easily with your custom post type. This is the WordPress’ way to do the task you are trying to do. This way, you can use, WordPress’ core functions like, WP_query etc to query your custom post type on the front end or you can create a custom template for the custom post type and this way you can also manage all items (custom post for application) in the back en very easily.