Example #1
0
 /**
  * If the option is set, add a map link to category lists.
  *
  * list_cats {@link http://codex.wordpress.org/Plugin_API/Filter_Reference#Category_Filters filter}
  * called by WordPress.
  *
  * @since 1.0
  */
 public static function list_cats($content, $category = null)
 {
     global $geo_mashup_options;
     if ($category and 'category' == $category->taxonomy) {
         $count = GeoMashupDB::category_located_post_count($category->cat_ID);
         // Add map link only if there are geo-located posts to see
         if ($count) {
             // This feature doesn't work unless there is a category description
             if (empty($category->description)) {
                 return $content . $geo_mashup_options->get('overall', 'category_link_separator') . __('You must add a description to this category to use this Geo Mashup feature.', 'GeoMashup');
             }
             $url = get_page_link($geo_mashup_options->get('overall', 'mashup_page'));
             if (strstr($url, '?')) {
                 $url .= '&';
             } else {
                 $url .= '?';
             }
             $link = '<a href="' . $url . 'map_cat=' . $category->cat_ID . '&amp;zoom=' . $geo_mashup_options->get('overall', 'category_zoom') . '" title="' . $geo_mashup_options->get('overall', 'category_link_text') . '">';
             return $content . '</a>' . $geo_mashup_options->get('overall', 'category_link_separator') . $link . $geo_mashup_options->get('overall', 'category_link_text');
         }
     }
     return $content;
 }