Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 225 lines (191 sloc) 5.808 kb
180e769f »
2011-07-05 first commit
1 <?php
2 /**
3 * Functions
4 *
5 * @package BE Genesis Child
6 * @author Bill Erickson <bill@billerickson.net>
7 * @copyright Copyright (c) 2011, Bill Erickson
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 *
10 */
11
12 /**
13 * Theme Setup
14 *
15 * This setup function attaches all of the site-wide functions
16 * to the correct hooks and filters. All the functions themselves
17 * are defined below this setup function.
18 *
19 */
20
21 add_action('genesis_setup','child_theme_setup');
22 function child_theme_setup() {
23
24 // ** Backend **
25 // Remove Unused Menu Items
26 add_action('admin_menu', 'be_remove_menus');
27
28 // Customize Menu Order
29 add_filter( 'custom_menu_order', 'be_custom_menu_order' );
30 add_filter( 'menu_order', 'be_custom_menu_order' );
31
32 // Set up Post Types
33 //add_action( 'init', 'be_create_my_post_types' );
34
35 // Set up Taxonomies
36 //add_action( 'init', 'be_create_my_taxonomies' );
37
38 // Set up Meta Boxes
39 //add_action( 'init' , 'be_create_metaboxes' );
40
41 // Setup Sidebars
42 //unregister_sidebar('sidebar-alt');
43 //genesis_register_sidebar(array('name' => 'Blog Sidebar', 'id' => 'blog-sidebar'));
44 //add_theme_support( 'genesis-footer-widgets', 3 );
45
46 // Remove Unused Page Layouts
47 //genesis_unregister_layout( 'full-width-content' );
48 //genesis_unregister_layout( 'content-sidebar' );
49 //genesis_unregister_layout( 'sidebar-content' );
50 //genesis_unregister_layout( 'content-sidebar-sidebar' );
51 //genesis_unregister_layout( 'sidebar-sidebar-content' );
52 //genesis_unregister_layout( 'sidebar-content-sidebar' );
53
54 // Setup Shortcodes
55 include_once( CHILD_DIR . '/lib/functions/shortcodes.php');
56
8ff256c7 »
2011-07-06 Add sample widget and remove function that removes breadcrumbs
57 // Setup Widgets
58 //include_once( CHILD_DIR . '/lib/widgets/widget-social.php');
59
180e769f »
2011-07-05 first commit
60 // ** Frontend **
61 // Remove Edit link
62 add_filter( 'edit_post_link', '__return_false' );
63 }
64
65 // ** Backend Functions ** //
66
67 /**
68 * Remove Menu Items
69 *
70 * Remove unused menu items by adding them to the array.
71 * See the commented list of menu items for reference.
72 *
73 */
74
75 function be_remove_menus () {
76 global $menu;
77 $restricted = array(__('Links'));
78 // Example:
79 //$restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
80 end ($menu);
81 while (prev($menu)){
82 $value = explode(' ',$menu[key($menu)][0]);
83 if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
84 }
85 }
86
87 /**
88 * Customize Menu Order
89 *
90 * @param $menu_ord. Current order.
91 * @return $menu_ord. New order.
92 *
93 */
94
95 function be_custom_menu_order( $menu_ord ) {
96 if ( !$menu_ord ) return true;
97 return array(
98 'index.php', // this represents the dashboard link
99 'edit.php?post_type=page', //the page tab
100 'edit.php', //the posts tab
101 'edit-comments.php', // the comments tab
102 'upload.php', // the media manager
103 );
104 }
105
106 /**
107 * Create Post Types
108 *
109 * @link http://codex.wordpress.org/Function_Reference/register_post_type
110 *
111 */
112
113 function be_create_my_post_types() {
114 $labels = array(
115 'name' => 'Rotator Items',
116 'singular_name' => 'Rotator Item',
117 'add_new' => 'Add New',
118 'add_new_item' => 'Add New Rotator Item',
119 'edit_item' => 'Edit Rotator Item',
120 'new_item' => 'New Rotator Item',
121 'view_item' => 'View Rotator Item',
122 'search_items' => 'Search Rotator Items',
123 'not_found' => 'No rotator items found',
124 'not_found_in_trash' => 'No rotator items found in trash',
125 'parent_item_colon' => '',
126 'menu_name' => 'Rotator'
127 );
128
129 $args = array(
130 'labels' => $labels,
131 'public' => true,
132 'publicly_queryable' => true,
133 'show_ui' => true,
134 'show_in_menu' => true,
135 'query_var' => true,
136 'rewrite' => true,
137 'capability_type' => 'post',
138 'has_archive' => false,
139 'hierarchical' => false,
140 'menu_position' => null,
141 'supports' => array('title','thumbnail','excerpt')
142 );
143
144 register_post_type( 'rotator', $args );
145 }
146
147 /**
148 * Create Taxonomies
149 *
150 * @link http://codex.wordpress.org/Function_Reference/register_taxonomy
151 *
152 */
153
154 function be_create_my_taxonomies() {
155 $labels = array(
156 'name' => 'Locations',
157 'singular_name' => 'Location',
158 'search_items' => 'Search Locations',
159 'all_items' => 'All Locations',
160 'parent_item' => 'Parent Location',
161 'parent_item_colon' => 'Parent Location:',
162 'edit_item' => 'Edit Location',
163 'update_item' => 'Update Location',
164 'add_new_item' => 'Add New Location',
165 'new_item_name' => 'New Location Name',
166 'menu_name' => 'Location'
167 );
168
169 register_taxonomy( 'rotator-location', array('rotator'), array(
170 'hierarchical' => true,
171 'labels' => $labels,
172 'show_ui' => true,
173 'query_var' => true,
174 'rewrite' => array( 'slug' => 'rotator-location' ),
175 ));}
176
177 /**
178 * Create Metaboxes
179 *
180 * @link http://www.billerickson.net/wordpress-metaboxes/
181 *
182 */
183
184 function be_create_metaboxes() {
185 $prefix = 'be_';
186 $meta_boxes = array();
187
188 $meta_boxes[] = array(
189 'id' => 'rotator-options',
190 'title' => 'Rotator Options',
191 'pages' => array('rotator'), // post type
192 'context' => 'normal',
193 'priority' => 'low',
194 'show_names' => true, // Show field names left of input
195 'fields' => array(
196 array(
197 'name' => 'Instructions',
198 'desc' => 'In the right column upload a featured image. Make sure this image is at least 900x360px wide. Then fill out the information below.',
199 'type' => 'title',
200 ),
201 array(
202 'name' => 'Display Info',
203 'desc' => 'Show Title and Excerpt from above',
204 'id' => 'show_info',
205 'type' => 'checkbox'
206 ),
207 array(
208 'name' => 'Clickthrough URL',
209 'desc' => 'Where the Learn More button goes',
210 'id' => 'url',
211 'type' => 'text'
212 ),
213 ),
214 );
215
216 require_once(CHILD_DIR . '/lib/metabox/init.php');
217 }
218
219
220
221 // ** Frontend Functions ** //
222
223
224 // ** Helper Functions ** //
Something went wrong with that request. Please try again.