I’m not sure I quite understand what you’ve done, so if you’d like to share the code here I’ll happily take a look.
Thread Starter
DigTek
(@digtek)
Sorry, the changes made were to this function.
I also wanted to skip a plugin, so added that bit,
but the main thing was being able to offer a Short Description.
My little hack works fine, but it was not immediately obvious
how I could add the maximum length to the shortcode,
like max_desc=140 rather than having it hard coded.
<code>
function replace_plugin_list_tags( $plugin_data, $format, $nofollow, $target ) {
// SKIP PLUGIN BY NAME
if ($plugin_data['Title'] == "Plugin Name") { unset($format); }
// CREATE SHORT DESCRIPTION (truncate at first period or 140 characters)
$pre_desc = explode('.', $plugin_data['Description']);
$sho_desc = $pre_desc[0];
$pos=strpos($sho_desc, ' ', 140);
$sho_desc = (strlen($sho_desc) > 140) ? substr($sho_desc,0,$pos).'...' : $sho_desc.'.';
$format = strtr(
$format,
array(
'{{Title}}' => $plugin_data['Title'],
'{{PluginURI}}' => $plugin_data['PluginURI'],
'{{AuthorURI}}' => $plugin_data['AuthorURI'],
'{{Version}}' => $plugin_data['Version'],
'{{Description}}' => $plugin_data['Description'],
'{{ShortDesc}}' => $sho_desc,
'{{Author}}' => $plugin_data['Author'],
'{{LinkedTitle}}' => "<a href='" . $plugin_data['PluginURI'] . "' title='" . $plugin_data['Title'] . "'" . $nofollow . $target . '>' . $plugin_data['Title'] . '</a>',
'{{LinkedAuthor}}' => "<a href='" . $plugin_data['AuthorURI'] . "' title='" . $plugin_data['Author'] . "'" . $nofollow . $target . '>' . $plugin_data['Author'] . '</a>',
'#Title#' => $plugin_data['Title'],
'#PluginURI#' => $plugin_data['PluginURI'],
'#AuthorURI#' => $plugin_data['AuthorURI'],
'#Version#' => $plugin_data['Version'],
'#Description#' => $plugin_data['Description'],
'#Author#' => $plugin_data['Author'],
'#LinkedTitle#' => "<a href='" . $plugin_data['PluginURI'] . "' title='" . $plugin_data['Title'] . "'" . $nofollow . $target . '>' . $plugin_data['Title'] . '</a>',
'#LinkedAuthor#' => "<a href='" . $plugin_data['AuthorURI'] . "' title='" . $plugin_data['Author'] . "'" . $nofollow . $target . '>' . $plugin_data['Author'] . '</a>',
'{{' => '<',
'}}' => '>',
'{' => '<',
'}' => '>',
)
);
return $format;
}
</code>
-
This reply was modified 3 years ago by
DigTek.
Thanks. Okay, now I understand what it is that you’re doing. Next question – why? Why do you need a short description?
Thread Starter
DigTek
(@digtek)
Personal preference I guess. I think the page is cleaner when all the items have a one line description. Some get long winded, but in most cases that one line does help explain what the plugin does when the title is not sufficient. I was just messing with some options mainly for my own use, but here is the page if you want to see why I like it that way.
https://wpmain.elite-star-services.com/plugin-testing/
Thanks for the context – that’s really helpful. I’ll look to add something like this, with the option to specify length.
https://github.com/dartiss/plugins-list/issues/41