From 88acb5fe767e8d93d8d449dc4f06ededf4ad8fb1 Mon Sep 17 00:00:00 2001 From: Monika Eftimova Date: Sat, 4 Oct 2014 16:38:17 +0300 Subject: [PATCH] Create custom post type for Sponsors --- functions.php | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index ad377a9..42b65b1 100644 --- a/functions.php +++ b/functions.php @@ -70,4 +70,52 @@ function sh_latest_posts($atts){ return $result; -} \ No newline at end of file +} + +# Add support for thumbnais +add_theme_support( 'post-thumbnails' ); + + +# Create a custom post type for Sponsors +function create_sponsors_posttype() { + + $labels = array( + 'name' => __( 'Sponsors' ), + 'singular_name' => __( 'Sponsor' ), + 'menu_nam' => __( 'Sponsors'), + 'all_items' => __( 'All Sponsors' ), + 'view_item' => __( 'View Sponsor' ), + 'add_new_item' => __( 'Add New Sponsor' ), + 'add_new' => __( 'Add New' ), + 'edit_item' => __( 'Edit Sponsor' ), + 'update_item' => __( 'Update Sponsor' ), + 'search_item' => __( 'Search Sponsor' ), + 'not_found' => __( 'Not Found' ), + 'not_found_in_trash' => __( 'Not Found In Trash' ), + ); + + $args = array( + 'label' => __( 'sponsors' ), + 'description' => __( 'Sponsors of OpenFest' ), + 'labels' => $labels, + 'supports' => array( 'title', 'excerpt', 'thumbnail', 'custom-fields', ), + 'hierarchical' => false, + 'public' => true, + 'show_ui' => true, + 'show_in_menu' => true, + 'show_in_nav_menus' => true, + 'show_in_admin_bar' => true, + 'menu_position' => 5, + 'can_export' => true, + 'has_archive' => true, + 'exclude_from_search' => false, + 'publicly_queryable' => true, + 'capability_type' => 'post', + ); + + register_post_type( 'sponsors', $args ); +} + +add_action( 'init', create_sponsors_posttype ); + +?>