Title: [Plugin: PHP Snippets] Minor bug report
Last modified: August 20, 2016

---

# [Plugin: PHP Snippets] Minor bug report

 *  [shazdeh](https://wordpress.org/support/users/shazdeh/)
 * (@shazdeh)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/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.
 * [http://wordpress.org/extend/plugins/php-snippets/](http://wordpress.org/extend/plugins/php-snippets/)

Viewing 1 replies (of 1 total)

 *  [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * (@fireproofsocks)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-php-snippets-minor-bug-report/#post-2430213)
 * Whoops, just saw this now… I guess I wasn’t subscribed to updates.
 * Yeah, I’ve been thinking about that — it’s a good point. But that’s why we’re
   in beta heehee. Man, I wish ALL of WP returned values instead of printed them.
 * You can file bugs and feature requests @ [http://code.google.com/p/wordpress-php-snippets/issues/list](http://code.google.com/p/wordpress-php-snippets/issues/list)

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: PHP Snippets] Minor bug report’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/php-snippets.svg)
 * [PHP Snippets](https://wordpress.org/plugins/php-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/php-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-snippets/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [fireproofsocks](https://wordpress.org/support/users/fireproofsocks/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-php-snippets-minor-bug-report/#post-2430213)
 * Status: not resolved