| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * Twenty Eleven functions and definitions |
|---|
| 4 | * Functions that are not pluggable (not wrapped in function_exists()) are instead attached |
|---|
| 5 | * to a filter or action hook. The hook can be removed by using remove_action() or |
|---|
| 6 | * remove_filter() and you can attach your own function to the hook. |
|---|
| 7 | * |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | /** |
|---|
| 11 | * Tell WordPress to run jumpline_setup() when the 'after_setup_theme' hook is run. |
|---|
| 12 | */ |
|---|
| 13 | add_action( 'after_setup_theme', 'jumpline_setup' ); |
|---|
| 14 | |
|---|
| 15 | if ( ! function_exists( 'jumpline_setup' ) ): |
|---|
| 16 | /** |
|---|
| 17 | * Sets up theme defaults and registers support for various WordPress features. |
|---|
| 18 | * |
|---|
| 19 | * Note that this function is hooked into the after_setup_theme hook, which runs |
|---|
| 20 | * before the init hook. The init hook is too late for some features, such as indicating |
|---|
| 21 | * support post thumbnails. |
|---|
| 22 | * |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | function jumpline_setup() { |
|---|
| 26 | |
|---|
| 27 | // This let's you add shortcode in wigets |
|---|
| 28 | add_filter('widget_text', 'do_shortcode'); |
|---|
| 29 | |
|---|
| 30 | // This theme styles the visual editor with editor-style.css to match the theme style. |
|---|
| 31 | add_editor_style(); |
|---|
| 32 | |
|---|
| 33 | // Add default posts and comments RSS feed links to head |
|---|
| 34 | add_theme_support( 'automatic-feed-links' ); |
|---|
| 35 | |
|---|
| 36 | // Post Format support. |
|---|
| 37 | add_theme_support( 'post-formats', array( 'aside', 'gallery', 'chat' ) ); |
|---|
| 38 | |
|---|
| 39 | //Custom background |
|---|
| 40 | add_theme_support( 'custom-background' ); |
|---|
| 41 | |
|---|
| 42 | //Thumbnails |
|---|
| 43 | add_theme_support( 'post-thumbnails' ); |
|---|
| 44 | |
|---|
| 45 | add_image_size( 'page-horse-thumb', 285, 200, true); //auto croped to fit |
|---|
| 46 | set_post_thumbnail_size( 285, 200, true); |
|---|
| 47 | |
|---|
| 48 | add_image_size( 'page-horses-thumb', 560, 400, true); //auto croped to fir |
|---|
| 49 | set_post_thumbnail_size( 560, 400, true); |
|---|
| 50 | |
|---|
| 51 | // This theme uses wp_nav_menu() in two location. |
|---|
| 52 | register_nav_menus( |
|---|
| 53 | array( |
|---|
| 54 | 'primary' => __( 'Standard Menu' ), |
|---|
| 55 | 'second' => __( 'Horses Menu' ) |
|---|
| 56 | ) |
|---|
| 57 | ); |
|---|
| 58 | |
|---|
| 59 | // The custom header business starts here. |
|---|
| 60 | $defaults = array( |
|---|
| 61 | 'default-image' => get_template_directory_uri() . '/images/header/logo.png', |
|---|
| 62 | 'random-default' => false, |
|---|
| 63 | 'width' => 160, |
|---|
| 64 | 'height' => 165, |
|---|
| 65 | 'flex-height' => false, |
|---|
| 66 | 'flex-width' => false, |
|---|
| 67 | 'default-text-color' => '', |
|---|
| 68 | 'header-text' => true, |
|---|
| 69 | 'uploads' => true, |
|---|
| 70 | 'wp-head-callback' => '', |
|---|
| 71 | 'admin-head-callback' => '', |
|---|
| 72 | 'admin-preview-callback' => '', |
|---|
| 73 | ); |
|---|
| 74 | add_theme_support( 'custom-header', $defaults ); |
|---|
| 75 | |
|---|
| 76 | } |
|---|
| 77 | endif; //end function jumpline_setup |
|---|
| 78 | |
|---|
| 79 | //Register our sidebars and widgetized areas. |
|---|
| 80 | |
|---|
| 81 | function jumpline_widgets_init() { |
|---|
| 82 | |
|---|
| 83 | register_sidebar( array( |
|---|
| 84 | 'name' => __( 'Showcase Sidebar', 'jumpline' ), |
|---|
| 85 | 'id' => 'sidebar-1', |
|---|
| 86 | 'description' => __( 'The showcase for the landing site', 'jumpline' ), |
|---|
| 87 | 'before_widget' => '<aside id="showcase" class="widget %2$s">', |
|---|
| 88 | 'after_widget' => "</aside>", |
|---|
| 89 | 'before_title' => '<h2 class="widget-title">', |
|---|
| 90 | 'after_title' => '</h2>', |
|---|
| 91 | ) ); |
|---|
| 92 | |
|---|
| 93 | register_sidebar( array( |
|---|
| 94 | 'name' => __( 'Aside Sidebar', 'jumpline' ), |
|---|
| 95 | 'id' => 'sidebar-2', |
|---|
| 96 | 'description' => __( 'Aside sidebar for templates', 'jumpline' ), |
|---|
| 97 | 'before_widget' => '<div id="sidebar" class="widget %2$s">', |
|---|
| 98 | 'after_widget' => "</div>", |
|---|
| 99 | 'before_title' => '<h3 class="jumpline">', |
|---|
| 100 | 'after_title' => '</h3>', |
|---|
| 101 | ) ); |
|---|
| 102 | |
|---|
| 103 | register_sidebar( array( |
|---|
| 104 | 'name' => __( 'Footer Area', 'jumpline' ), |
|---|
| 105 | 'id' => 'sidebar-3', |
|---|
| 106 | 'description' => __( 'An optional widget area for your site footer', 'jumpline' ), |
|---|
| 107 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
|---|
| 108 | 'after_widget' => "</div>", |
|---|
| 109 | 'before_title' => '<h3 class="widget-title">', |
|---|
| 110 | 'after_title' => '</h3>', |
|---|
| 111 | ) ); |
|---|
| 112 | |
|---|
| 113 | register_sidebar( array( |
|---|
| 114 | 'name' => __( 'Showcase Kontakt', 'jumpline' ), |
|---|
| 115 | 'id' => 'sidebar-4', |
|---|
| 116 | 'description' => __( 'The showcase for the contact page', 'jumpline' ), |
|---|
| 117 | 'before_widget' => '<aside id="kontakt" class="%1$s">', |
|---|
| 118 | 'after_widget' => "</aside>", |
|---|
| 119 | 'before_title' => '<h3 class="widget-title">', |
|---|
| 120 | 'after_title' => '</h3>', |
|---|
| 121 | ) ); |
|---|
| 122 | |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | add_action( 'widgets_init', 'jumpline_widgets_init' ); |
|---|
| 126 | |
|---|
| 127 | //register horses custom post type |
|---|
| 128 | function horses_custom_post_type() { |
|---|
| 129 | $labels = array( |
|---|
| 130 | 'name' => _x('Horses', 'post type general name'), |
|---|
| 131 | 'singular_name' => _x('Horse', 'post type singular name'), |
|---|
| 132 | 'add_new' => _x('Add New', 'horse'), |
|---|
| 133 | 'add_new_item' => __('Add New Horse'), |
|---|
| 134 | 'edit_item' => __('Edit Horse'), |
|---|
| 135 | 'new_item' => __('New Horse'), |
|---|
| 136 | 'all_items' => __('All horses'), |
|---|
| 137 | 'view_item' => __('View horse'), |
|---|
| 138 | 'search_items' => __('Search horses'), |
|---|
| 139 | 'not_found' => __('No horses found'), |
|---|
| 140 | 'not_found_in_trash' => __('No horses found in Trash'), |
|---|
| 141 | 'parent_item_colon' => '', |
|---|
| 142 | 'menu_name' => __('Horses') |
|---|
| 143 | ); |
|---|
| 144 | |
|---|
| 145 | $args = array( |
|---|
| 146 | 'labels' => $labels, |
|---|
| 147 | 'public' => true, |
|---|
| 148 | 'publicly_queryable' => true, |
|---|
| 149 | 'show_ui' => true, |
|---|
| 150 | 'show_in_menu' => true, |
|---|
| 151 | 'query_var' => true, |
|---|
| 152 | 'rewrite' => array( 'slug' => 'horses' ), |
|---|
| 153 | 'taxonomies' => array ( 'type' ), |
|---|
| 154 | 'has_archive' => true, |
|---|
| 155 | 'hierarchical' => true, |
|---|
| 156 | 'menu_position' => null, |
|---|
| 157 | 'supports' => array( 'title', 'editor', 'custom-fields', 'thumbnail' ) |
|---|
| 158 | ); |
|---|
| 159 | register_post_type('horses',$args); |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | add_action( 'init', 'horses_custom_post_type' ); |
|---|
| 163 | |
|---|
| 164 | //create custom taxonomies type for the post type "horses" |
|---|
| 165 | function add_type_taxonomies() { |
|---|
| 166 | // Add new "Type" taxonomy to Posts |
|---|
| 167 | register_taxonomy('type', 'horses', array( |
|---|
| 168 | // Hierarchical taxonomy (like categories) |
|---|
| 169 | 'hierarchical' => true, |
|---|
| 170 | // This array of options controls the labels displayed in the WordPress Admin UI |
|---|
| 171 | 'labels' => array( |
|---|
| 172 | 'name' => _x( 'Types', 'taxonomy general name' ), |
|---|
| 173 | 'singular_name' => _x( 'type', 'taxonomy singular name' ), |
|---|
| 174 | 'search_items' => __( 'Search Type' ), |
|---|
| 175 | 'all_items' => __( 'All Types' ), |
|---|
| 176 | 'parent_item' => __( 'Parent Type' ), |
|---|
| 177 | 'parent_item_colon' => __( 'Parent Type:' ), |
|---|
| 178 | 'edit_item' => __( 'Edit Types' ), |
|---|
| 179 | 'update_item' => __( 'Update Type' ), |
|---|
| 180 | 'add_new_item' => __( 'Add New Type' ), |
|---|
| 181 | 'new_item_name' => __( 'New Type Name' ), |
|---|
| 182 | 'menu_name' => __( 'Types' ), |
|---|
| 183 | ), |
|---|
| 184 | // Control the slugs used for this taxonomy |
|---|
| 185 | 'rewrite' => array( |
|---|
| 186 | 'slug' => 'horses/type', // This controls the base slug that will display before each term |
|---|
| 187 | 'with_front' => false, // Don't display the category base before "/locations/" |
|---|
| 188 | 'hierarchical' => true // This will allow URL's like "/types/tavling/horse-name/" |
|---|
| 189 | ), |
|---|
| 190 | )); |
|---|
| 191 | } |
|---|
| 192 | add_action( 'init', 'add_type_taxonomies', 0 ); |
|---|
| 193 | ?> |
|---|