Execute PHP Code (not a WordPress Function) on specific side
-
Hi all,
I love code Snippets and I managed to do some amazing things with it (for my little knowledge). But I am not able to execute my php code on a specific site. I read through this forum and got the idea to use is_single but I don’t get how to execute my code and displaying the result (Title of the page I want to try that is “tmv”). With this code nothing happens ??if ( is_single('tmv') ){ function dir_size($directory) { $size = 0; foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){ $size += $file->getSize(); } return $size; } function format_size($size) { $mod = 1024; $units = explode(' ','B KB MB GB TB PB'); for ($i = 0; $size > $mod; $i++) { $size /= $mod; } return round($size, 2) . ' ' . $units[$i]; } $oldsize=dir_size("/var/www/cm"); echo "Ergebnis:".$oldsize; } echo "Hallo Welt 2";
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Execute PHP Code (not a WordPress Function) on specific side’ is closed to new replies.