{"id":5652,"date":"2026-02-22T20:30:02","date_gmt":"2026-02-22T20:30:02","guid":{"rendered":"https:\/\/kastamonugezirehberi.com\/?page_id=5652"},"modified":"2026-08-07T20:18:13","modified_gmt":"2026-08-07T17:18:13","slug":"kastamonuda-gezilecek-yerler","status":"publish","type":"page","link":"https:\/\/kastamonugezirehberi.com\/en\/kastamonuda-gezilecek-yerler\/","title":{"rendered":"Kastamonu&#8217;da Gezilecek Yerler"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"5652\" class=\"elementor elementor-5652\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-3c248af e-flex e-con-boxed e-con e-parent\" data-id=\"3c248af\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-af3d02b elementor-widget elementor-widget-shortcode\" data-id=\"af3d02b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\">    <div class=\"gezi-kontrolleri\">\n        <!-- Arama Kutusu -->\n        <input type=\"text\" id=\"gezi-arama\" placeholder=\"Aramak istedi\u011finiz kelimeyi yaz\u0131n!\">\n        \n        <!-- Butonlar (Varsay\u0131lan olarak \"\u00d6NER\u0130LEN\" aktif ba\u015flar) -->\n        <div class=\"gezi-buton-grubu\">\n            <button id=\"btn-normal-sirala\" class=\"aktif\">\u00d6NER\u0130LEN<\/button>\n            <button id=\"btn-alfabetik-sirala\">A - Z<\/button>\n            <button id=\"btn-konum-sirala\">KONUM<\/button>\n            <button id=\"btn-konum-guncelle\" style=\"display:none;\">Konumu G\u00fcncelle<\/button>\n        <\/div>\n\n        <!-- Ak\u0131ll\u0131 Kategori Filtreleri (Varsay\u0131lan olarak \"T\u00fcm\u00fc\" aktif ba\u015flar) -->\n        <div class=\"gezi-kategoriler\">\n            <button class=\"kat-filtre aktif\" data-kat=\"hepsi\">T\u00fcm\u00fc<\/button>\n                    <\/div>\n    <\/div>\n\n    <!-- ==========================================\n         2. GEZ\u0130 NOKTALARI L\u0130STES\u0130\n         ========================================== -->\n    <div id=\"gezi-listesi\">\n            <\/div>\n\n    <!-- ==========================================\n         3. SAYFA \u0130\u00c7\u0130 ETK\u0130LE\u015e\u0130M JS KODLARI\n         ========================================== -->\n\n\t\t\t\n\t\t\t<script>\n    document.addEventListener(\"DOMContentLoaded\", function() {\n        const listContainer = document.getElementById('gezi-listesi');\n        const cards = Array.from(document.querySelectorAll('.gezi-kart'));\n        const searchInput = document.getElementById('gezi-arama');\n        \n        \/\/ T\u00fcrk\u00e7e karakterleri hem b\u00fcy\u00fck hem k\u00fc\u00e7\u00fck harfte kusursuz e\u015fitleyen fonksiyon\n        function turkceKucukHarf(metin) {\n            if (!metin) return \"\";\n            var harfler = { \"\u0130\": \"i\", \"I\": \"\u0131\", \"\u015e\": \"\u015f\", \"\u011e\": \"\u011f\", \"\u00dc\": \"\u00fc\", \"\u00d6\": \"\u00f6\", \"\u00c7\": \"\u00e7\", \"b\": \"b\" };\n            \/\/ \u00d6nce gelen metindeki b\u00fcy\u00fck T\u00fcrk\u00e7e harfleri manuel olarak e\u015fliyoruz\n            metin = metin.replace(\/(([\u0130I\u015e\u011e\u00dc\u00c7\u00d6]))\/g, function(harf){ return harfler[harf]; });\n            return metin.toLowerCase().trim();\n        }\n\n        \/\/ 1. ARAMA \u0130\u015eLEM\u0130\n        searchInput.addEventListener('input', function() {\n            const searchText = turkceKucukHarf(this.value);\n            \n            cards.forEach(card => {\n                \/\/ PHP'den gelen veri yerine do\u011frudan kart\u0131n i\u00e7indeki H3 ba\u015fl\u0131\u011f\u0131n\u0131 okuyup temizliyoruz\n                const rawTitle = card.querySelector('h3').textContent;\n                const title = turkceKucukHarf(rawTitle);\n                \n                if (title.includes(searchText)) {\n                    card.style.display = 'block';\n                } else {\n                    card.style.display = 'none';\n                }\n            });\n        });\n\n        \/\/ ==========================================\n        \/\/ SIRALAMA BUTONLARINI YE\u015e\u0130L YAPMA MANTI\u011eI\n        \/\/ ==========================================\n        const siralamaButonlari = [\n            document.getElementById('btn-normal-sirala'), \n            document.getElementById('btn-alfabetik-sirala'), \n            document.getElementById('btn-konum-sirala')\n        ];\n\n        function siralamaAktifYap(secilenButon) {\n            siralamaButonlari.forEach(btn => {\n                if(btn) btn.classList.remove('aktif');\n            });\n            if(secilenButon) secilenButon.classList.add('aktif');\n        }\n\n\/\/ 2. KATEGOR\u0130 F\u0130LTRELEME (Bu blo\u011fu tamamen de\u011fi\u015ftirin)\n        const katButtons = document.querySelectorAll('.kat-filtre');\n        katButtons.forEach(btn => {\n            btn.addEventListener('click', function(e) {\n                katButtons.forEach(b => b.classList.remove('aktif'));\n                this.classList.add('aktif');\n\n                const secilenKat = this.getAttribute('data-kat');\n                \n                cards.forEach(card => {\n                    const kartKat = card.getAttribute('data-kategori');\n                    if (secilenKat === 'hepsi' || kartKat.includes(secilenKat)) {\n                        card.style.display = 'block';\n                    } else {\n                        card.style.display = 'none';\n                    }\n                });\n\n                \/\/ YEN\u0130: Sadece kullan\u0131c\u0131 fareyle t\u0131klad\u0131ysa URL'yi de\u011fi\u015ftir\n                if (e && e.isTrusted) {\n                    if (secilenKat === 'hepsi') {\n                        window.history.pushState({ kat: 'hepsi' }, '', '\/ineboluda-gezilecek-yerler\/');\n                    } else {\n                        window.history.pushState({ kat: secilenKat }, '', '\/kategori\/' + secilenKat + '\/');\n                    }\n                }\n            });\n        });\n\n        \/\/ 3. ALFABET\u0130K SIRALAMA (Geli\u015fmi\u015f T\u00fcrk\u00e7e Dil Deste\u011fi ile)\n        document.getElementById('btn-alfabetik-sirala').addEventListener('click', function() {\n            siralamaAktifYap(this);\n            \n            cards.sort((a, b) => {\n                const titleA = a.querySelector('h3').textContent;\n                const titleB = b.querySelector('h3').textContent;\n                \/\/ localeCompare('tr') sayesinde \u00c7, \u011e, \u0130, \u015e harfleri T\u00fcrk\u00e7e alfabesine g\u00f6re kusursuz s\u0131ralan\u0131r\n                return titleA.localeCompare(titleB, 'tr', { sensitivity: 'base' });\n            });\n            \n            cards.forEach(card => listContainer.appendChild(card));\n        });\n\n        \/\/ 4. VARSAYILAN SIRALAMA\n        document.getElementById('btn-normal-sirala').addEventListener('click', function() {\n            siralamaAktifYap(this);\n            cards.sort((a, b) => parseInt(a.getAttribute('data-sira')) - parseInt(b.getAttribute('data-sira')));\n            cards.forEach(card => {\n                listContainer.appendChild(card);\n                card.querySelector('.mesafe-alani').style.display = 'none';\n            });\n            document.getElementById('btn-konum-guncelle').style.display = 'none';\n            document.getElementById('btn-konum-sirala').textContent = 'KONUM';\n        });\n\n        \/\/ 5. KONUMA G\u00d6RE SIRALAMA\n        const btnKonum = document.getElementById('btn-konum-sirala');\n        const btnKonumGuncelle = document.getElementById('btn-konum-guncelle');\n\n        function konumuHesaplaVeSirala() {\n            siralamaAktifYap(btnKonum);\n\n            if (\"geolocation\" in navigator) {\n                btnKonum.textContent = \"Hesaplan\u0131yor...\";\n                \n                navigator.geolocation.getCurrentPosition(function(position) {\n                    const userLat = position.coords.latitude;\n                    const userLng = position.coords.longitude;\n\n                    cards.forEach(card => {\n                        const destLat = parseFloat(card.getAttribute('data-enlem'));\n                        const destLng = parseFloat(card.getAttribute('data-boylam'));\n                        \n                        if(destLat && destLng && !isNaN(destLat) && !isNaN(destLng)) {\n                            const mesafeKm = getDistanceFromLatLonInKm(userLat, userLng, destLat, destLng);\n                            card.setAttribute('data-mesafe', mesafeKm);\n                            \n                            const mesafeAlani = card.querySelector('.mesafe-alani');\n                            \n                            let gosterilecekMesafe = \"\";\n                            if (mesafeKm < 1) {\n                                gosterilecekMesafe = Math.round(mesafeKm * 1000) + \" m\";\n                            } else {\n                                gosterilecekMesafe = mesafeKm.toFixed(2) + \" km\";\n                            }\n\n                            mesafeAlani.textContent = \"Uzakl\u0131k: \" + gosterilecekMesafe;\n                            mesafeAlani.style.display = 'inline-block';\n                        } else {\n                            card.setAttribute('data-mesafe', 99999);\n                            card.querySelector('.mesafe-alani').style.display = 'none';\n                        }\n                    });\n\n                    cards.sort((a, b) => parseFloat(a.getAttribute('data-mesafe')) - parseFloat(b.getAttribute('data-mesafe')));\n                    cards.forEach(card => listContainer.appendChild(card));\n\n                    btnKonum.textContent = \"KONUM\";\n                    btnKonumGuncelle.style.display = 'inline-block';\n\n                }, function(error) {\n                    alert(\"Konum izni al\u0131namad\u0131. L\u00fctfen taray\u0131c\u0131 ayarlar\u0131ndan konuma izin verin.\");\n                    btnKonum.textContent = \"KONUM\";\n                });\n            } else {\n                alert(\"Taray\u0131c\u0131n\u0131z konum \u00f6zelli\u011fini desteklemiyor.\");\n            }\n        }\n\n        btnKonum.addEventListener('click', konumuHesaplaVeSirala);\n        btnKonumGuncelle.addEventListener('click', konumuHesaplaVeSirala);\n\n        \/\/ Haversine Form\u00fcl\u00fc\n        function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n            var R = 6371; \n            var dLat = deg2rad(lat2-lat1);  \n            var dLon = deg2rad(lon2-lon1); \n            var a = Math.sin(dLat\/2) * Math.sin(dLat\/2) +\n                    Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon\/2) * Math.sin(dLon\/2); \n            var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n            return R * c;\n        }\n\n        function deg2rad(deg) {\n            return deg * (Math.PI\/180)\n        }\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\/\/ 6. URL'DEN KATEGOR\u0130 YAKALAMA VE OTOMAT\u0130K SE\u00c7ME\n        const mevcutYol = window.location.pathname; \n        \n        \/\/ E\u011fer adres \u00e7ubu\u011funda \"kategori\" kelimesi ge\u00e7iyorsa \u00e7al\u0131\u015ft\u0131r\n        if (mevcutYol.includes('\/kategori\/')) {\n            \/\/ URL'yi par\u00e7alara ay\u0131r ve son k\u0131sm\u0131 (slug) al. \u00d6rn: \"tarihi-yerler\"\n            const parcalar = mevcutYol.split('\/').filter(Boolean);\n            const urlKategoriSlug = parcalar[parcalar.length - 1]; \n            \n            \/\/ HTML i\u00e7indeki o kategoriye ait butonu bul\n            const hedefKategoriButonu = document.querySelector(`.kat-filtre[data-kat=\"${urlKategoriSlug}\"]`);\n            \n            \/\/ Buton bulunduysa, kullan\u0131c\u0131 t\u0131klam\u0131\u015f gibi otomatik t\u0131kla\n            if (hedefKategoriButonu) {\n                hedefKategoriButonu.click(); \n            }\n        }\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\/\/ 7. TARAYICI GER\u0130 \/ \u0130LER\u0130 BUTONU DESTE\u011e\u0130 (Step 6'n\u0131n hemen alt\u0131na eklenecek)\n        window.addEventListener('popstate', function() {\n            const yol = window.location.pathname;\n            if (yol.includes('\/kategori\/')) {\n                const parcalar = yol.split('\/').filter(Boolean);\n                const urlKategoriSlug = parcalar[parcalar.length - 1];\n                const hedefButon = document.querySelector(`.kat-filtre[data-kat=\"${urlKategoriSlug}\"]`);\n                if (hedefButon) hedefButon.click();\n            } else {\n                const tumuButonu = document.querySelector(`.kat-filtre[data-kat=\"hepsi\"]`);\n                if (tumuButonu) tumuButonu.click();\n            }\n\t\t});\n\t\t\n\t\t\n\t\t\n\t\t\n    });\n    <\/script>\n\t\t\t\n\t\t\t\n    <\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_glsr_average":0,"_glsr_ranking":0,"_glsr_reviews":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-5652","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/pages\/5652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/comments?post=5652"}],"version-history":[{"count":650,"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/pages\/5652\/revisions"}],"predecessor-version":[{"id":9354,"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/pages\/5652\/revisions\/9354"}],"wp:attachment":[{"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/media?parent=5652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/categories?post=5652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kastamonugezirehberi.com\/en\/wp-json\/wp\/v2\/tags?post=5652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}