Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $provinces_cat_id = 6;
- $current_cat = get_query_var('cat');
- $thisCat = get_category($current_cat,false);
- $subjects= get_categories('hide_empty=0&child_of='.$current_cat);
- if(isset($_GET['show']) && $_GET['show'] == 'map') { // show the maps
- if(isset($_GET['type']) && $_GET['type'] == 'provinces'){
- $thisCat_parent = get_category($current_cat,false);
- // show map of country with clickable provinces
- echo 'show map of country with clickable provinces';
- $provinces = get_categories('hide_empty=0&exclude=1&orderby=slug&order=ASC&parent='.$provinces_cat_id);
- echo "<ul class=\"country\">";
- foreach($provinces as $province) {
- $postsinregions = get_posts('hide_empty=0&category='.$province->cat_ID);
- if(!$postsinregions) {
- echo "<li class=\"".$province->cat_name."\"></li>";
- } else {
- echo "<li class=\"".$province->cat_name."\"><a href=\"" . get_category_link($current_cat) . "?show=map&type=regio&place_id=".$province->cat_ID."\"><span>". get_cat_name($province->cat_ID) ."</span></a> has posts</li>";
- $sublevel_cat = get_posts(array( 'category__and' => array( $province->cat_ID, $current_cat ) ) );
- if($sublevel_cat) {
- echo 'category '.get_cat_name($province->cat_ID).' has post about '.get_cat_name($current_cat);
- } else {
- echo 'category '.get_cat_name($province->cat_ID).' has no posts about '.get_cat_name($current_cat);
- }
- }
- }
- echo "</ul>";
- echo "<li>Go back to: <a href=\"" . get_category_link($thisCat_parent->parent) . "\"><span>". get_cat_name($thisCat_parent->parent) ."</span></a></li>";
- }
- }
- if(isset($_GET['type']) && $_GET['type'] == 'regio') {
- if(isset($_GET['place_id']) && $_GET['place_id']) {
- echo 'show map of province with clickable regios: '.get_cat_name($_GET['place_id']);
- // show map of province with clickable regios
- $regios = get_categories('hide_empty=0&exclude=1&orderby=slug&order=ASC&parent='.$_GET['place_id']);
- $catid = $_GET['place_id'];
- $catname = get_cat_name($catid);
- echo "<ul class=\"Province-" . $catname . "\">";
- $i = 1;
- foreach($regios as $regio) {
- $postsinregions = get_posts('hide_empty=0&category='.$regio->cat_ID);
- if(!$postsinregions) {
- echo "<li class=\"regio".$i."\"></li>";
- } else {
- echo "<li class=\"regio".$i."\"><a href=\"" . get_category_link($current_cat) . "?show=posts&type=regio&place_id=".$regio->cat_ID."\"><span>". get_cat_name($regio->cat_ID) ."</span></a> has posts</li>";
- $sublevel_cat = get_posts(array( 'category__and' => array( $regio->cat_ID, $current_cat ) ) );
- if($sublevel_cat) {
- echo 'category '.get_cat_name($regio->cat_ID).' has post about '.get_cat_name($current_cat);
- } else {
- echo 'category '.get_cat_name($regio->cat_ID).' has no post about '.get_cat_name($current_cat);
- }
- $i++;
- }
- echo "</ul>";
- echo "<li>Go back to: <a href=\"" . get_category_link($current_cat) . "?show=map&type=provinces\"><span>Country map</span></a></li>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement