--- romeluv-maps.php.orig
+++ romeluv-maps.php
@@ -51,6 +51,12 @@
'romeluv_maps_inner_custom_box',
'post'
);
+ add_meta_box(
+ 'romeluv_maps_sectionid',
+ __( 'Maps', 'romeluv_maps_textdomain' ),
+ 'romeluv_maps_inner_custom_box',
+ 'page'
+ );
}
@@ -361,6 +367,7 @@
}
add_action('save_post', 'romeluv_maps_handle_savepost');
+add_action('save_page', 'romeluv_maps_handle_savepost');
@@ -385,7 +392,7 @@
if ($romeluv_single_map_done) return $post_content_html; else $romeluv_single_map_done=TRUE;
- if (!is_single()) return $post_content_html;
+ if (!is_single() && !is_page()) return $post_content_html;
//return "".$post_content_html;
global $wpdb,$post,$mapheight;
$savepost=$post;
@@ -552,13 +559,25 @@
global $wpdb,$post;
$savepost=$post;
+
+ extract( shortcode_atts( array(
+ 'cat' => '', // category ID
+ ), $atts ) );
+ if (esc_attr($cat) == '') {
+ if (isset($_GET[cat])) $get_cat = $_GET[cat];
+ } else {
+ $get_cat = esc_attr($cat);
+ };
+
+
+
////query all the posts to display on the global map
$querystr = "
SELECT wposts.*
FROM $wpdb->posts wposts
WHERE wposts.post_status = 'publish'
- AND wposts.post_type = 'post' ". $whereadditional ."
+ AND (wposts.post_type = 'post' OR wposts.post_type = 'page') ". $whereadditional ."
ORDER BY wposts.post_date DESC
";
//echo $querystr; //useful for debugging your custom query
@@ -571,9 +590,7 @@
if ($result_posts):
- if (isset($_GET[cat])) echo '<h3 id="map-category-heading">'.get_cat_name($_GET[cat]).'</h3>';
-
-
+ if (isset($get_cat)) echo '<h3 id="map-category-heading">'.get_cat_name($get_cat).'</h3>';
$mapwidth=get_option('global_romeluv_mapwidth');
$mapheight=get_option('global_romeluv_mapheight');
@@ -614,7 +631,7 @@
$count++;
- if (isset($_GET[cat])) if (!in_category($_GET[cat],$post->ID)) continue; //this allows category filtering adding the $_GET parameter ?cat=xx
+ if (isset($get_cat)) if (!in_category($get_cat,$post->ID)) continue; //this allows category filtering adding the $_GET parameter ?cat=xx
if (is_category()) { if (!in_category($cat_ID,$post->ID)) continue; } //skip posts if viewing a category page, if those do not match the current category