Skip to content

Instantly share code, notes, and snippets.

@rehmatworks
Last active November 18, 2016 14:29
Show Gist options
  • Save rehmatworks/172b2531cadc4fa9cf5ecbd8f9dd62db to your computer and use it in GitHub Desktop.
Save rehmatworks/172b2531cadc4fa9cf5ecbd8f9dd62db to your computer and use it in GitHub Desktop.
require_once ('/path/SimpleShortcodes.php');
$simpleshortcodes = new SimpleShortcodes();
$shortcodes = array('[name]' => '{$name}');
$simpleshortcodes->add($shortcodes);
// An array that contains user information. You can use multidimensional arrays to include more details about the user
$users = array('User 1', 'User 2', 'User 3', 'User 4', 'User 5');
$message = 'Hello [name], we are here with the introduction to our newest product. Blah blah blah...';
// Loop through the array and create $name variable which we need for our shortcode
foreach($users AS $name) {
$message = $simpleshortcodes->read($message);
var_dump($message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment