Yazılar
Yazılım, akıllı ev, kendi sunucun ve yerel AI üzerine notlar.
Son yazılar
yazı
Bu tarayıcıda saklanır; diğer cihazlara eşitlenmez.
Yeni yazılar eklendikçe burada yer alacak. Şimdilik araç rehberine ve kod örneklerine göz atabilirsin.
'Ana gezinme']);}
add_action('after_setup_theme','baa_setup');
function baa_asset($path){return get_template_directory_uri().'/assets/'.ltrim($path,'/');}
function baa_read_data($file){$path=get_template_directory().'/assets/'.$file;$data=is_file($path)?json_decode(file_get_contents($path),true):[];return is_array($data)?$data:[];}
function baa_tools_url(){$p=get_page_by_path('arac-rehberi');return $p&&$p->post_status==='publish'?get_permalink($p):home_url('/');}
function baa_all_posts(){static $posts=null;if($posts===null)$posts=get_posts(['post_type'=>'post','post_status'=>'publish','numberposts'=>100,'orderby'=>'date','order'=>'DESC']);return $posts;}
function baa_post_data($post){$cats=[];foreach(get_the_category($post->ID) as $cat)$cats[]=['id'=>$cat->term_id,'slug'=>$cat->slug,'name'=>$cat->name];$text=wp_strip_all_tags(strip_shortcodes($post->post_content));$excerpt=wp_trim_words(wp_strip_all_tags(get_the_excerpt($post)),26);return ['id'=>(string)$post->ID,'title'=>html_entity_decode(get_the_title($post),ENT_QUOTES,'UTF-8'),'url'=>get_permalink($post),'excerpt'=>html_entity_decode($excerpt,ENT_QUOTES,'UTF-8'),'categories'=>$cats,'search_text'=>mb_substr($text,0,8000),'date'=>get_the_date('', $post),'image'=>baa_visual_image_data($post)];}
/** Observe the selected template, not a broad conditional like is_archive(). */
function baa_listing_template($template) {
$root = get_template_directory();
$listing_templates = ['front-page.php', 'home.php', 'page-blog.php', 'search.php', 'archive.php', 'index.php'];
$GLOBALS['baa_listing_template'] = in_array($template, array_map(function($file) use ($root) { return $root.'/'.$file; }, $listing_templates), true);
return $template;
}
add_filter('template_include', 'baa_listing_template', PHP_INT_MAX);
function baa_is_listing() { return !empty($GLOBALS['baa_listing_template']); }
/** Retain /blog/ as a 200 alias; do not change other routes or paged canonicals. */
function baa_is_blog_alias() {
if (!is_page('blog') || is_preview() || is_feed() || is_paged() || (int)get_query_var('page') > 1) return false;
$request_path = wp_parse_url(wp_unslash($_SERVER['REQUEST_URI'] ?? ''), PHP_URL_PATH);
return $request_path === wp_parse_url(home_url('/blog/'), PHP_URL_PATH);
}
function baa_blog_canonical($url) { return is_string($url) && $url !== '' && baa_is_blog_alias() ? home_url('/') : $url; }
function baa_blog_native_canonical($url, $post) {
return $post && (int)$post->ID === (int)get_queried_object_id() ? baa_blog_canonical($url) : $url;
}
add_filter('wpseo_canonical', 'baa_blog_canonical', 20);
add_filter('get_canonical_url', 'baa_blog_native_canonical', 20, 2);
function baa_enqueue(){
foreach(['site.css','code-colors.css'] as $file)wp_enqueue_style('baa-'.sanitize_key($file),baa_asset($file),[],(string)filemtime(get_template_directory().'/assets/'.$file));
wp_enqueue_script('baa-site',baa_asset('site.js'),[],(string)filemtime(get_template_directory().'/assets/site.js'),true);
$data=['home'=>home_url('/')];
if (baa_is_listing()) {
$data['posts']=array_map('baa_post_data',baa_all_posts());
$data['search']=(string)get_search_query();
$data['category']=is_category()?(string)get_queried_object()->slug:'all';
}
wp_add_inline_script('baa-site','window.BAAConfig='.wp_json_encode($data,JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS|JSON_HEX_QUOT).';','before');
}
add_action('wp_enqueue_scripts','baa_enqueue',99);
function baa_bookmark_icon(){return '';}
function baa_save($id){echo '';}
function baa_meta($post){$names=[];foreach(get_the_category($post->ID) as $cat)$names[]=$cat->name;echo esc_html(implode(' · ',$names));$date=get_the_date('', $post);if($date)echo ' · '.esc_html($date).'';}
function baa_card($post){$d=baa_post_data($post);?> Yazılım, akıllı ev, kendi sunucun ve yerel AI üzerine notlar. yazı Bu tarayıcıda saklanır; diğer cihazlara eşitlenmez. Yeni yazılar eklendikçe burada yer alacak. Şimdilik araç rehberine ve kod örneklerine göz atabilirsin.Yazılar
Son yazılar
['class'=>true]]); ?>
'.preg_replace('~?code\\b[^>]*>~i','',$m[2]).'