I Downloaded a wordpress widget and i was wondering if it was possibleto limit the char in the title.
Snippet from the area that gives us the title
complete code
Snippet from the area that gives us the title
PHP Code:
if ($author_has_url) echo '</a>';
echo $url;
echo $comment->post_title;
PHP Code:
/*
* Called by register_sidebar_widget() function.
* Rendering of the widget happens here.
*/
function widget($args) {
global $wpdb;
extract($args);
$options = get_option($this->_folder);
$this->validate_options($options);
if (is_single() && $options['show_in_post'] != 'checked') return;
if (is_page() && $options['show_in_page'] != 'checked') return;
$author_emails = array();
if (!empty($options['author_emails'])) {
$author_emails = explode(',', $options['author_emails']);
}
$sql = "SELECT a.*, b.post_title from $wpdb->comments a JOIN $wpdb->posts b ON a.comment_post_id = b.id WHERE comment_approved= '1' AND a.comment_type != 'pingback'
ORDER BY comment_date DESC LIMIT " . $options['num_of_comments'];
$comments = $wpdb->get_results($sql);
echo $before_widget;
echo $before_title;
echo is_single() && ($options['single_mode'] == 'checked') ? $options['single_mode_title'] : $options['title'];
echo $after_title;
echo '<div class="rcg-div">';
if ($comments) {
echo '<ul>';
foreach ($comments as $comment) {
$author_has_url = !(empty($comment->comment_author_url) || 'http://' == $comment->comment_author_url);
$is_author = in_array($comment->comment_author_email, $author_emails);
$url_author = '<a href="' . $comment->comment_author_url . '" title="' . $comment->comment_author . '" rel="external nofollow" target="_blank">';
$url = '<a href="'. get_permalink($comment->comment_post_ID).'#comment-'.$comment->comment_ID .'" title="'.$comment->comment_author .' | '.get_the_title($comment->comment_post_ID).'">';
echo '<li ' . ($is_author ? 'class="rcg-author"' : '') . '><div class="rcg-wrapper">';
echo '<div class="rcg-avatar">';
echo $author_has_url ? $url_author : '<span title="' . $comment->comment_author . '">';
echo get_avatar($comment->comment_author_email, intval($options['gravatar_width']));
echo $author_has_url ? '</a>' : '</span>';
echo '</div>';
echo '<div class="rcg-text" style="padding-left:' . (intval($options['gravatar_width']) + 10) . 'px">';
if ($author_has_url) echo $url_author;
if ($author_has_url) echo '</a>';
echo $url;
echo $comment->post_title;
echo '</a><br/> ';
echo '</div>';
echo '</div></li>';
}
echo '</ul>';
}
if ($options['link_to_us'] == 'checked') {
echo '<div class="rcg-link"><a href="' . $this->_link . '" target="_blank">'. __('Get this widget for your own blog free!', $this->_folder) . '</a></div>';
}
echo '</div>';
echo $after_widget;
}
Comment