Wordpress Cache Sistemi
-
<?php include("cache.php"); cache_baslat(); define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require( dirname( __FILE__ ) . '/wp-blog-header.php' ); cache_bitir();
index.php
<?php $ftp_cache = 6000; // dakika cinsinden include('Mobile_Detect.php'); function cache_baslat(){ global $ftp_cache; $detect = new Mobile_Detect; $filename = md5($_SERVER['REQUEST_URI']).'.cache'; $cachesi = true; if( $detect->isMobile() ){ $filename = md5($_SERVER['REQUEST_URI']).'_mobile.cache'; } if( $detect->isTablet() ){ $filename = md5($_SERVER['REQUEST_URI']).'_tablet.cache'; } $cachefile = 'cache/'.$filename; if($cachesi){ define('_CACHEDOSYASI', $cachefile); $zaman = 6000 * $ftp_cache; $cachetime = $zaman; if (file_exists($cachefile)){ if(time() - $cachetime < filemtime($cachefile)){ readfile($cachefile); exit; }else{ unlink($cachefile); } } } ob_start(); } function cache_bitir(){ if(defined('_CACHEDOSYASI')){ $fp = fopen(_CACHEDOSYASI, 'w+'); fwrite($fp, ob_get_contents()); fclose($fp); ob_end_flush(); } } ?>
cache.php
https://github.com/serbanghita/Mobile-Detect/archive/2.8.25.zip
mobil.php dosyası
trafik yapan wordpress sitelerinin karın ağrısı olan load sorunu için kullana bilirsiniz memnun kalmazsanız yazın mobil dosyasını ekleme sebebim mobil tema kullanan arkadaşların hızlarında ciddi artış olucaktır load düşüceğinden dolayı cache klasörü oluşturun chmod 777 verin içine boş bir index.html koyun robotlar indexlemesin yazada robots.txt de cache klasörünü engelleyin
-
Teşekkürler hocam, akşam deneyeyim
-
Paylaşım için teşekkürler hocam.