GET https://blogkit.apps.gianthard.rocks/api/v1/slugify?t=如何科学饲养母猪HTTP/2 200 OKserver:nginxdate:Mon, 19 Aug 2024 10:01:06 GMTcontent-type:application/json; charset=utf-8age:189318cache-control:public,max-age=31536000content-length:24x-http2-stream-id:3"scientific-sow-rearing"
要在 WordPress 中自动调用的话,需要在 WordPress 管理页面添加一些代码:
functionsuggest_slug_from_api($slug,$post_id,$post_status,$post_type,$post_parent,$original_slug ){// Only apply for new posts or when the slug is emptyif(empty($slug)){$post =get_post($post_id);$title =$post ?$post->post_title :'';if(empty($title)){return$slug;// Return original slug if no title}$api_url ='https://blogkit.apps.gianthard.rocks/api/v1/slugify';// Encode the title for use in URL$query =http_build_query(array('t'=>$title));$url =$api_url .'?'.$query;// Make the API request$response =wp_remote_get($url);// Check if the request was successfulif(!is_wp_error($response)&&wp_remote_retrieve_response_code($response)==200){$body =wp_remote_retrieve_body($response);$suggested_slug =json_decode($body,true);// If we got a valid slug, use itif($suggested_slug &&is_string($suggested_slug)){return$suggested_slug;}}}// If anything goes wrong or if the post already has a custom slug, return the original slugreturn$slug;}add_filter('wp_unique_post_slug','suggest_slug_from_api',10,6);
Based on AAA’s data, the average monthly cost of owning and operating a car is $1,015. The organization used six cost categories to determine their average: depreciation, finance costs, fuel, insurance, government taxes and fees, and maintenance, repair and tires. They based their numbers on vehicles that were driven for approximately 15,000 miles a year and assumed a five-year ownership period. Your own rate will likely differ from the average since it is based on factors unique to you, your car and your situation.
春节假期,我的 EDC (Every Day Carry,每日携带物品)立了大功,不管是修理门锁还是处理小伤口,都派上了用场。接下来,我要和你们聊聊这些随身小物怎样解我燃眉之急。
假期之前,带我用的
春节假期前我按照“带你用的,用你带的”思路,给自己配置了一个可以塞进衣服口袋的随身 EDC 小包,里面放有我精心挑选的工具小物,旨在帮助我应对日常所需和一些较为紧急的情况。我的物品配置理念可以总结为三个原则:带能用的、带常用的、以及带“我”要用的。
三个原则
首先,选择装备应基于个人的知识储备,确保每一件装备都是你能够熟练使用的。这意味着,即使是最高端的工具,如果你不能熟练使用,它也不应该出现在你的 EDC 中。其次,针对高频场景选择用得上的装备,这要求我们对日常生活有深刻的观察和了解,确保 EDC 中的每一样物品都能在常见情况下派上用场。最后,每个人的生活方式和需求都有所不同,因此,配置 EDC 时还应考虑个人的独特需求,确保它真正适合自己。
多功能工具
我的 EDC 中携带的多功能工具很少,只有一把“钥匙”( https://geekey.com ),这个小工具在国内可以买到款式类似但价格更加亲民的盗版。我选择它主要是为了这些功能: