Understood.
On your next update, consider adding the following function to shortcode.php. It adds a shortcode to display a random name.
Use like this: [namedirectory_random dir=”2″]
function name_directory_show_random($attributes) {
$dir = null;
extract(shortcode_atts(
array('dir' => '1'),
$attributes
));
$name_filter = array();
$directory = name_directory_get_directory_properties($dir);
$names = name_directory_get_directory_names($directory, $name_filter);
$num_names = count($names);
if ($num_names > 0) {
$entry = $names[array_rand($names)];
ob_start();
echo '<div class="name_directory_random_name">';
echo '<div class="name_directory_name_box">';
echo '<a name="namedirectory_' . sanitize_html_class($entry['name']) . '"></a>';
echo '<strong>' . htmlspecialchars($entry['name']) . '</strong>';
if(! empty($directory['show_description']) && ! empty($entry['description']))
{
$print_description = html_entity_decode(stripslashes($entry['description']));
/* This toggles the read more/less indicators, these need extra html */
if(! empty($directory['nr_words_description']))
{
$num_words = intval($directory['nr_words_description']);
$short_desc = name_directory_get_words($print_description, $num_words);
$print_description = str_replace($short_desc, "", $print_description);
if(! empty($print_description))
{
echo '<br /><div>
<input type="checkbox" class="name-directory-readmore-state" id="name-' . htmlspecialchars($entry['id']) . '" />
<span class="name-directory-readmore-wrap">' . $short_desc . ' <span class="name-directory-readmore-target">' . $print_description .'</span></span>
<label for="name-' . htmlspecialchars($entry['id']) . '" class="name-directory-readmore-trigger"></label>
</div>';
}
else
{
echo '<br /><div>' . $short_desc . '</div>';
}
}
else {
echo '<br /><div>' . $print_description . '</div>';
}
}
if(! empty($directory['show_submitter_name']) && ! empty($entry['submitted_by']))
{
echo "<small>" . __('Submitted by:', 'name-directory') . " " . $entry['submitted_by'] . "</small>";
}
echo '</div>';
echo '</div>';
return ob_get_clean();
}
}
add_shortcode('namedirectory_random', 'name_directory_show_random');
I noticed in another thread you just became a parent. Happy parenting! ??