สร้างหน้าเว็บ Intro ทำให้ index.html ใช้ร่วมกับ WordPress
วิธีทำหน้า intro แบบไฟล์ index.html กับ wordpress แยกออกมาโดยไม่ใช้ wp-content/themes/name/home.php หรือ front-page.php เพื่อในวาระพิเศษวันสำคัญต่างๆ ..
with fucntions.php /without .htaccess & plugin for nginx/apache server.
วิธีทำให้ wordpress ใช้ url จาก feedburnner(เช่น feeds.feedburner.com/taxze) แทนจาก url ของเว็บบล๊อคปกติ(เช่น taxze.com/feed) ช่วยให้ลดภาระทางเซิฟเวอร์กรณีโดนบอทดูดบทความได้บ้าง..มั้งนะ และแถมโค้ดวิธีทำให้ feed เว็บเราดีเลย์จากหน้าเว็บจริงจากปกติได้ด้วย เผื่อจะต้องปรับแต่งบทความหลายรอบเพื่อให้สมบูรณ์ก่อนฟีดเด้งอะไรแบบนี้ โดยทั้งหมดทำผ่าน functions.php ของธีมนั้นๆ โดยไม่ต้องลงปลั๊กอิน และยังรองรับเซิฟเวอร์ nginx ที่ใช้ .htaccess ไม่ได้ด้วย
<?php
// To rewrite the feed links
add_filter('feed_link', 'my_feedburner_feed_link', 1, 2);
// To redirect feeds
add_action('template_redirect', 'my_feed_redirect');
function my_feed_redirect() {
global $feed;
// Change this
$new_feed = 'https://feeds.feedburner.com/taxze';
if (!is_feed()) {
return;
}
if (preg_match('/feedburner|feedvalidator/i', $_SERVER['HTTP_USER_AGENT'] ?? '')){
return;
}
if ($feed != 'comments-rss2') {
if (function_exists('status_header')) status_header( 302 );
header("Location:" . $new_feed);
header("HTTP/1.1 302 Temporary Redirect");
exit();
}
}
function my_feedburner_feed_link($output, $feed){
// Change this
$new_feed = 'https://feeds.feedburner.com/taxze';
if($feed!='comments-rss2'){
$feed_array = array('rss' => $new_feed , 'rss2' => $new_feed , 'atom' => $new_feed , 'rdf' => $new_feed , 'comments_rss2' => $new_feed);
$feed_array[$feed] = $new_feed;
$output = $feed_array[$feed];
}
return $output;
}
?>
<?php
add_filter('posts_where', 'publish_later_on_feed');
function publish_later_on_feed($where) {
global $wpdb;
if ( is_feed() ) {
// timestamp in WP-format
$now = gmdate('Y-m-d H:i:s');
// value for wait; + device
$wait = '5'; // integer
// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
$device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
// add SQL-sytax to default $where
$where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}
?>
//exclude feed category
add_filter('pre_get_posts','tz_exclude_category_feed');
function tz_exclude_category_feed($query) {
if ($query->is_feed) {
$query->set('cat','-60');
}
return $query;
}
October 5, 2017 / updated: February 28, 2025
วิธีทำหน้า intro แบบไฟล์ index.html กับ wordpress แยกออกมาโดยไม่ใช้ wp-content/themes/name/home.php หรือ front-page.php เพื่อในวาระพิเศษวันสำคัญต่างๆ ..
enable classic editor / disable gutenberg in function.php without plugin wordpress //code from wp.org/plugins/enable-classic-editor/ and another if( !..
วิธีล้างแคช cloudflare ง่ายๆ กดใช้งานได้จากตรง admin menubar ด้านของ Wordpress เพียงแค่เพิ่มโค้ดในไฟล์ function.php ของ theme ที่ใช้งานอยู่ อย่าลืมใส่..
วิธีเซตใช้ https ให้กับโดเมนของเว็บเราโดยไม่ต้องเสียเงินซื้อ ssl ตามเว็บขายโฮส ด้วยระบบของ cloudflare และสามารถมีฟังก์ชันการแคชไฟล์ static เช่น js/css..
#1. Install library libevent cd /tmp #wget http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz #tar xzvf libevent-1.4.13-stable.tar.gz #cd libev..
hide your referrer Create an anonymous link that will hide the HTTP Referer header. example https://domain.ltd/?https://www.google.com ..