Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Smarty for WordPress

Smarty for WordPress permits your Smarty template file to be embedded in a WordPress post/page.

Please do not be afraid of asking questions?

(There are no stupid or dumb questions!)

How can I dynamically set my Smarty variables before loading my Smarty template

  • Use a third party plugin called, Exec-PHP (http://wordpress.org/extend/plugins/exec-php/) permits execution of PHP code from the post/page. You can them use smarty_get_instance to set your variables and load your template from within your WP pages/posts.

How do I change WP_USE_THEMES to false without changing WordPress core files like index.php

  • You need to install runkit on your web server and then in your wp-config.php, you need to add the following two lines: runkit_constant_remove('WP_USE_THEMES'); define('WP-USE_THEMES',false); Now Wordpres themes will be turned off and load the Smarty Loader instead, if enabled.
  • See http://php.net/manual/en/runkit.installation.php for assistance on installing runkit

What configurations are needed to load Smarty without WordPress themes

  • You need to specify two constants in your wp-config.
  • define('SMARTY_PATH','/var/www/smarty'); // where your smarty files are located
  • define('SMARTY_LOADER','/var/www/smartyloader.php'); // the name of the file which will load your smarty files

My Smarty templates are not loading from the Smarty loader, I just get a blank screen

  • You need to invoke the plugin function smarty_get_instance() and assign to your $smarty variable.

How do I access the WPDB object from the Smarty Loader

  • use the syntax global $wpdb; within the smarty loader file.

Requires: 2.8.6 or higher
Compatible up to: 4.7.2
Last Updated: 6 hours ago
Active Installs: 200+


0 out of 5 stars


Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.