[Plugin: PHP Snippets] Minor bug report
-
Shortcodes must return values, not echoing them directly. So when you do “You know, today is: [current_date]. Awesome!” first you see the current_date and then the text.
The solution is rather easy, I modified the __call function in includes/PHP_Snippet.php:public function __call($name, $args) { // get the file by name if (isset($this->snippets[$name]) && file_exists($this->snippets[$name])) { $file = $this->snippets[$name]; ob_start(); include $this->snippets[$name]; $content = ob_get_clean(); return $content; } else { die('file does not exist: ' . $name); } }
BTW, I love the idea of the plugin.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: PHP Snippets] Minor bug report’ is closed to new replies.