Skip to content

Commit 8b4b967

Browse files
author
Joe Hawes
committed
Improved Shortcode Header Collection Shortcode logic
1 parent 05a5895 commit 8b4b967

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

inc/Front/Waymark_Shortcode.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,40 +169,41 @@ function handle_shortcode($shortcode_data, $content = null) {
169169
//Header ?
170170
$do_header = 0;
171171

172-
//Start with Setting
172+
// Start with Setting
173173
$setting = Waymark_Config::get_setting('misc', 'shortcode_options', 'shortcode_header');
174174
if (is_numeric($setting)) {
175175
$do_header = $setting;
176176
}
177177

178-
// Waymark_Helper::debug($do_header);
178+
// Shortcode option set?
179+
if (array_key_exists('shortcode_header', $shortcode_data)) {
180+
$param = $shortcode_data['shortcode_header'];
181+
182+
if (is_numeric($param)) {
183+
$do_header = $param;
184+
}
185+
}
179186

180187
//Map Details Page
181188
if (get_post_type() == 'waymark_map') {
182189
//Map Details Page
183190
if (is_single()) {
184191
$do_header = 0;
185-
//Archive
186-
} else {
187-
$do_header = 0;
188192
}
193+
//Archive
194+
// } else {
195+
// $do_header = 0;
196+
// }
189197
//I.e. Embedding using the Shortcode
190198
} else {
191199
//Always for Admin
192200
if (current_user_can('administrator') && Waymark_Config::get_setting('misc', 'shortcode_options', 'header_override')) {
193201
$do_header = 1;
194-
} else {
195-
//Shortcode
196-
if (array_key_exists('shortcode_header', $shortcode_data)) {
197-
$param = $shortcode_data['shortcode_header'];
198-
199-
if (is_numeric($param)) {
200-
$do_header = $param;
201-
}
202-
}
203202
}
204203
}
205204

205+
// Waymark_Helper::debug($do_header);
206+
206207
//Header (non Map pages only)
207208
if ($do_header && sizeof($shortcode_header)) {
208209
$out .= ' <!-- Shortcode Header -->' . "\n";

0 commit comments

Comments
 (0)