You could do this by loading the output via admin-ajax.php
, but a better approach to that is to use WordPress SHORTINIT constant so you can load just what functions you need, but you will need to find and load wp-load.php
to do this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
// send CSS Header header("Content-type: text/css; charset: UTF-8"); // faster load by reducing memory with SHORTINIT define('SHORTINIT', true); // recursively find WordPress load function find_require($file,$folder=null) { if ($folder === null) {$folder = dirname(__FILE__);} $path = $folder.DIRECTORY_SEPARATOR.$file; if (file_exists($path)) {require($path); return $folder;} else { $upfolder = find_require($file,dirname($folder)); if ($upfolder != '') {return $upfolder;} } } // load WordPress core (minimal) $wp_root_path = find_require('wp-load.php'); define('ABSPATH', $wp_root_path); define('WPINC', 'wp-includes'); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.