How To Execute PHP Inside Table in WP Table Reloaded WordPress Plugin

To enable PHP execution inside table in WP Table Reloaded WordPress plugin, it require you to create your own WordPress plugin and insert a piece of PHP function within.

To create a plugin, simple use your favorite text editor like notepad ++ or just simply your PC’s built-in notepad. Create a new text file and insert your standard plugin information at the top, see sample below:

<?php
/*
Plugin Name: name of your plugin
Plugin URI: url of page describing your plugin
Description: a brief description of your plugin.
Version: your plugin version number, e.g.: 1.0
Author: your name
Author URI: url of plugin author
License: a slug license name e.g. GPL2
*/


//insert your code below before the closing php ?> tag

?>

Then below ‘//Insert your code here‘… comment, add this function:

function wp_table_reloaded_execute_php_in_cells($cell_content) {
	ob_start();
	eval('?>'.$cell_content);
	$output = ob_get_clean();
	return $output;
}
add_filter('wp_table_reloaded_cell_content','wp_table_reloaded_execute_php_in_cells');

Save the file with .php extension and name it ‘wp-table-reloaded-extensions.php‘. Then, place it inside a folder and name it wp-table-reloaded-extensions (with no space and special characters). Next, upload the whole folder (wp-table-reloaded-extensions folder you created awhile ago) in your server inside your wordpress site’s plugin directory via ftp, typically in /public_html/yourdomain.com/wp-content/plugins folder.

Lastly, login to your WordPress site’s Admin Dashboard Panel and go to >PLUGINS and activate it.

That’s it. You can now insert php code inside table that you created using WP-Table-Reloaded plugin.

Thanks to Tobias Baethge for sharing this awesome plugin.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s