Plugin Directory

Changeset 3086288


Ignore:
Timestamp:
05/14/2024 07:21:43 AM (23 months ago)
Author:
belingo
Message:

Исправлено исключение, если текущего города нет в списке. Исправлена карта сайта, когда исключены все обычные записи. Исправлена фатальная ошибка в карте сайте, когда нет исключённых такосономий.

Location:
belingogeo/trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • belingogeo/trunk/includes/core-functions.php

    r3077769 r3086288  
    371371        $city = belingogeo_get_city_by('slug', $current_city);
    372372    }
     373
     374    if(!$city) {
     375        return true;
     376    }
    373377   
    374378    if($city && $city->get_slug() == 'default-city') {
  • belingogeo/trunk/includes/sitemaps.php

    r3003610 r3086288  
    123123        }
    124124
    125         $page = 1;
    126         while($post_pages >= $page) {
    127             $url = [
    128                 "loc" => get_site_url() . '/'.$city->get_slug().'_post.sitemap'.$page.'.xml',
    129                 "lastmod" => date('c',time())
    130             ];
    131             $xml .= belingoGeo_get_xml_sitemap($url);
    132             $page++;
     125        $belingo_geo_exclude_all_posts = get_option('belingo_geo_exclude_all_posts');
     126        if(!$belingo_geo_exclude_all_posts) {
     127            $page = 1;
     128            while($post_pages >= $page) {
     129                $url = [
     130                    "loc" => get_site_url() . '/'.$city->get_slug().'_post.sitemap'.$page.'.xml',
     131                    "lastmod" => date('c',time())
     132                ];
     133                $xml .= belingoGeo_get_xml_sitemap($url);
     134                $page++;
     135            }
    133136        }
    134137        $page = 1;
     
    160163            $exclude_taxonomies = get_option('belingo_geo_exclude_taxonomies');
    161164            foreach($taxonomies as $taxonomy) {
    162                 if($taxonomy->public == 1 && $taxonomy->show_ui == 1 && !array_key_exists($taxonomy->name, $exclude_taxonomies)) {
     165                if($taxonomy->public == 1 && $taxonomy->show_ui == 1 && !array_key_exists($taxonomy->name, (array)$exclude_taxonomies)) {
    163166                    $url = [
    164167                        "loc" => get_site_url() . '/'.$city->get_slug().'_sitemap_tax_'.$taxonomy->name.'.xml',
     
    178181
    179182    $urls = [];
     183
     184    $belingo_geo_exclude_all_posts = get_option('belingo_geo_exclude_all_posts');
     185    if($belingo_geo_exclude_all_posts) {
     186        return $urls;
     187    }
    180188
    181189    // записи
Note: See TracChangeset for help on using the changeset viewer.