Changeset 663612
- Timestamp:
- 02/05/2013 07:48:47 AM (13 years ago)
- Location:
- wodtogether-whiteboards/trunk
- Files:
-
- 1 added
- 2 edited
-
readme.txt (modified) (2 diffs)
-
wod.php (added)
-
wodtogether-whiteboards.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wodtogether-whiteboards/trunk/readme.txt
r590689 r663612 3 3 Tags: embed, post, crossfit 4 4 Requires at least: 3.0 5 Tested up to: 3. 46 Stable tag: 2.0. 65 Tested up to: 3.5.1 6 Stable tag: 2.0.7 7 7 License: GPLv2 8 8 … … 22 22 23 23 == Changelog == 24 = 2.0.7 = 25 * adding ability to embed Todays WOD on static page instead of in blog posts 24 26 = 2.0.6 = 25 27 * adjusting counter position, handling click directly on counter -
wodtogether-whiteboards/trunk/wodtogether-whiteboards.php
r590681 r663612 43 43 add_settings_field('wodtogether_date_offset', 'Whiteboard Date Setting', 'wodtogether_setting_date_offset', 'wodtogether', 'wodtogether_main'); 44 44 add_settings_field('wodtogether_required_category', 'Required Category', 'wodtogether_setting_required_category', 'wodtogether', 'wodtogether_main'); 45 add_settings_field('wodtogether_iframe_height', 'iFrame Height (in pixels)', 'wodtogether_setting_iframe_height', 'wodtogether', 'wodtogether_main'); 46 add_settings_field('wodtogether_auto_resize', 'Attempt Auto-Resize', 'wodtogether_setting_auto_resize', 'wodtogether', 'wodtogether_main'); 45 add_settings_field('wodtogether_static_page', 'Static Page (Today\'s WOD)', 'wodtogether_setting_static_page', 'wodtogether', 'wodtogether_main'); 47 46 add_settings_field('wodtogether_show_wods', 'Show WOD Details by Default', 'wodtogether_setting_show_wods', 'wodtogether', 'wodtogether_main'); 48 47 } … … 77 76 echo "</select>"; 78 77 } 79 function wodtogether_setting_ iframe_height() {80 $options = get_option('wodtogether_options'); 81 if (!$options['iframe_height']) {82 $options['iframe_height'] = 700;83 }84 echo "<input id='wodtogether_iframe_height' name='wodtogether_options[iframe_height]' size='20' type='text' value='{$options['iframe_height']}' />";85 } 86 function wodtogether_setting_auto_resize() { 87 $options = get_option('wodtogether_options');88 89 $checked = (isset($options['auto_resize']) && $options['auto_resize']) ? ' checked' : '';90 echo "< input id='wodtogether_auto_resize' name='wodtogether_options[auto_resize]' {$checked} type='checkbox' value='1' />91 <p><strong> Recommended!</strong> This will attempt to automatically resize the whiteboard iframe so there are no scrollbars.</p>";78 function wodtogether_setting_static_page() { 79 $options = get_option('wodtogether_options'); 80 echo "<select id='wodtogether_static_page' name='wodtogether_options[static_page]'><option value=''>None </option>"; 81 82 $blog_pages = get_pages(); 83 84 foreach($blog_pages as $page) { 85 $selected = ($options['static_page'] == $page->ID) ? ' selected' : ''; 86 echo "<option value=\"{$page->ID}\"{$selected}>{$page->post_title}</option>"; 87 } 88 89 echo "</select> 90 <p><strong>Note:</strong> If you want to show Today's WOD on a static Page (instead of/in addition to on each blog post), select a page in the dropdown.</p>"; 92 91 } 93 92 function wodtogether_setting_show_wods() { … … 108 107 } 109 108 110 if (!is_numeric($input['iframe_height'])) {111 $input['date_offset'] = 700; // default to 700112 }113 114 109 if (!is_numeric($input['show_wods'])) { 115 110 $input['show_wods'] = 0; // default to off … … 117 112 118 113 $input['required_category'] = trim($input['required_category']); 114 115 if (!is_numeric($input['static_page'])) { 116 $input['static_page'] = 0; // default to main site 117 } 119 118 120 119 return $input; … … 143 142 ); 144 143 144 add_filter( 'page_template', 'wodtogether_page_template' ); 145 function wodtogether_page_template( $page_template ) 146 { 147 global $wodtogetherSettings; 148 149 $pageID = get_the_ID(); 150 if ( is_page( $pageID ) && $wodtogetherSettings['static_page'] == $pageID) { 151 $page_template = dirname( __FILE__ ) . '/wod.php'; 152 } 153 return $page_template; 154 } 155 156 145 157 /** 146 158 * Show whiteboard on each post 147 159 */ 148 160 add_filter('the_content', 'showWhiteboard'); 149 function showWhiteboard($input )161 function showWhiteboard($input, $todays_wods=false) 150 162 { 151 163 global $whiteboarded; 152 164 global $wodtogetherSettings; 153 165 154 if ( isset($wodtogetherSettings['required_category']) && $wodtogetherSettings['required_category']) {166 if (!is_page( $wodtogetherSettings['static_page'] ) && isset($wodtogetherSettings['required_category']) && $wodtogetherSettings['required_category']) { 155 167 $post_categories = get_the_category(); 156 168 $has_required_category = false; … … 170 182 171 183 $date_offset = (isset($wodtogetherSettings['date_offset']) && $wodtogetherSettings['date_offset']) ? 86400 : 0; 172 $date = date('Y-m-d', strtotime($GLOBALS['post']->post_date) + $date_offset); 184 185 $datestr = ($todays_wods) ? 'today' : $GLOBALS['post']->post_date; 186 $date = date('Y-m-d', strtotime($datestr) + $date_offset); 173 187 174 188 // show a max of 5 whiteboards per screen 175 189 if ($whiteboarded >= 5) { 176 return $input . "<br /><a href=\"http://wodtogether.com/whiteboard/view/date/{$date}/gym/{$gym_id}/embed/remote{$show_wods}\" >View Whitebaord</a>";190 return $input . "<br /><a href=\"http://wodtogether.com/whiteboard/view/date/{$date}/gym/{$gym_id}/embed/remote{$show_wods}\" class=\"wodtogether_wb_button btn btn-large\">View Whitebaord</a>"; 177 191 } 178 192
Note: See TracChangeset
for help on using the changeset viewer.