/** * Disable Auto-Update Email Notifications for Plugins and Themes. * Works for WordPress 5.5 and later. */ // Disable Plugin Auto-Update Emails add_filter( 'auto_plugin_update_send_email', '__return_false' ); // Disable Theme Auto-Update Emails add_filter( 'auto_theme_update_send_email', '__return_false' ); // Optional: Disable Core Auto-Update Emails (if you also want to stop these) // add_filter( 'auto_core_update_send_email', '__return_false', 10, 4 ); // Optional: Disable Translation Auto-Update Emails (if you also want to stop these) // add_filter( 'auto_translation_update_send_email', '__return_false' );
Random Images

Ngẫu nhiên hình ảnh bằng PHP

Random ImagesTrong quá trình thiết kế layout cho một php application có trường hợp cần nạp ngẫu nhiên hình ảnh theo mỗi yêu cầu nạp của trình duyệt, giải pháp đọc nội dung thư mục sau đó lấy các giá trị text của các file có phần mở rộng được khai báo trước rồi trả về trong mã HTML là một trong những cách đơn giản nhất

/**
 * Function choose_images
 * ------------------------------------------------------
 * Random image each time load website
 */
function choose_images() {
	$dirhandle = opendir( dirname(__FILE__) . "/images/");
	while (false !== ($filename = readdir($dirhandle))) {
		if ( substr($filename, -3) == "jpg") {
  		$image_listing[] = $filename;
	  	}
	}
	$image_key = array_rand($image_listing, 1);
	$image_choice = $image_listing[$image_key];
  echo  "/images/" . $image_choice;
}

Đọc tiếp→