本文整理汇总了PHP中comment_excerpt函数的典型用法代码示例。如果您正苦于以下问题:PHP comment_excerpt函数的具体用法?PHP comment_excerpt怎么用?PHP comment_excerpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了comment_excerpt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: et_list_pings
function et_list_pings($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
?>
<li id="comment-<?php
comment_ID();
?>
"><?php
comment_author_link();
?>
- <?php
comment_excerpt();
?>
<?php
}
示例2: recent_comments_4_my_posts
/**
* recent_comments_4_my_posts
*/
public static function recent_comments_4_my_posts()
{
?>
<!-- Recent comments for my posts -->
<div class="dashboard-recent-comments-4-my-posts panel">
<div class="heading">
<i class="fa fa-comments"></i>
<?php
echo ___('Recent comments for my posts');
?>
</div>
<?php
/**
* get comments
*/
$current_user_id = theme_cache::get_current_user_id();
$comments = get_comments(['post_author' => $current_user_id, 'author__not_in' => [$current_user_id], 'number' => 5, 'status' => '1']);
if (empty($comments)) {
?>
<div class="content">
<?php
echo status_tip('info', ___('No comment for your post yet'));
?>
</div>
<?php
} else {
?>
<ul class="list-group">
<?php
global $comment;
foreach ($comments as $comment) {
?>
<li class="list-group-item">
<div class="media">
<div class="media-left media-top">
<?php
$comment_author_url = get_comment_author_url();
if ($comment_author_url) {
?>
<a
href="<?php
echo esc_url($comment_author_url);
?>
"
<?php
echo (int) $comment->user_id === 0 ? 'target="_blank"' : null;
?>
>
<?php
echo theme_cache::get_avatar($comment, 50);
?>
</a>
<?php
} else {
echo theme_cache::get_avatar($comment, 50);
}
?>
</div>
<div class="media-body">
<h4 class="media-heading">
<?php
echo sprintf(___('%s commented your post "%s".'), '<span class="author">' . get_comment_author_link() . '</span>', '<a href="' . theme_cache::get_permalink($comment->comment_post_ID) . '">' . theme_cache::get_the_title($comment->comment_post_ID) . '</a>');
?>
</h4>
<p class="excerpt-tx">
<?php
comment_excerpt();
?>
</p>
</div><!-- /.media-body -->
</div><!-- /.media -->
</li>
<?php
}
?>
</ul>
<?php
}
/** end have comment */
?>
</div>
<?php
}
示例3: widget
//.........这里部分代码省略.........
<div class="tabs-data">
<?php
$i = 0;
foreach ($posts as $tab => $tab_posts) {
$i++;
$active = $i == 1 ? 'active' : '';
?>
<ul class="tab-posts <?php
echo $active;
?>
posts-list" id="recent-tab-<?php
echo esc_attr($i);
?>
">
<?php
if ($tabs[$tab] == 'comments') {
?>
<?php
foreach ($tab_posts as $comment) {
?>
<li class="comment">
<span class="author"><?php
printf('%s said', get_comment_author_link($comment->comment_ID));
?>
</span>
<p class="text"><?php
comment_excerpt($comment->comment_ID);
?>
</p>
<a href=""><?php
echo get_the_title($comment->comment_post_ID);
?>
</a>
</li>
<?php
}
?>
<?php
} else {
?>
<?php
while ($tab_posts->have_posts()) {
$tab_posts->the_post();
?>
<li>
<a href="<?php
the_permalink();
?>
"><?php
the_post_thumbnail('post-thumbnail', array('title' => strip_tags(get_the_title())));
?>
示例4: __
<th scope="col">' . __('Comment Excerpt') . '</th>
<th scope="col" colspan="3" style="text-align: center">' . __('Actions') . '</th>
</tr>
</thead>';
foreach ($comments as $comment) {
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$comment_status = wp_get_comment_status($comment->comment_ID);
$class = ('alternate' == $class) ? '' : 'alternate';
$class .= ('unapproved' == $comment_status) ? ' unapproved' : '';
?>
<tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
<td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
<td><?php comment_author_link() ?></td>
<td><?php comment_author_email_link() ?></td>
<td><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td>
<td><?php comment_excerpt(); ?></td>
<td>
<?php if ('unapproved' == $comment_status) { ?>
(Unapproved)
<?php } else { ?>
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php comment_ID() ?>" class="edit"><?php _e('View') ?></a>
<?php } ?>
</td>
<td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo "<a href='comment.php?action=editcomment&c=$comment->comment_ID' class='edit'>" . __('Edit') . "</a>"; } ?></td>
<td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
echo "<a href=\"comment.php?action=deletecomment&p=".$comment->comment_post_ID."&c=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by '%s'. \n 'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> ";
} ?></td>
</tr>
<?php
} // end foreach
示例5: _wp_dashboard_recent_comments_row
function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$GLOBALS['comment'] =& $comment;
$comment_post_url = get_edit_post_link( $comment->comment_post_ID );
$comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
$comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
$actions_string = '';
if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
// preorder it: Approve | Reply | Edit | Spam | Trash
$actions = array(
'approve' => '', 'unapprove' => '',
'reply' => '',
'edit' => '',
'spam' => '',
'trash' => '', 'delete' => ''
);
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
$approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
$spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
$actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>';
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
$actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
if ( !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
else
$actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
$actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
$i = 0;
foreach ( $actions as $action => $link ) {
++$i;
( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
// Reply and quickedit need a hide-if-no-js span
if ( 'reply' == $action || 'quickedit' == $action )
$action .= ' hide-if-no-js';
$actions_string .= "<span class='$action'>$sep$link</span>";
}
}
?>
<div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status($comment->comment_ID) ) ); ?>>
<?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
<?php echo get_avatar( $comment, 50, 'mystery' ); ?>
<div class="dashboard-comment-wrap">
<h4 class="comment-meta">
<?php printf( /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */__( 'From %1$s on %2$s%3$s' ),
'<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link.' '.$comment_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?>
</h4>
<?php
else :
switch ( $comment->comment_type ) :
case 'pingback' :
$type = __( 'Pingback' );
break;
case 'trackback' :
$type = __( 'Trackback' );
break;
default :
$type = ucwords( $comment->comment_type );
endswitch;
$type = esc_html( $type );
?>
<div class="dashboard-comment-wrap">
<?php /* translators: %1$s is type of comment, %2$s is link to the post */ ?>
<h4 class="comment-meta"><?php printf( _x( '%1$s on %2$s', 'dashboard' ), "<strong>$type</strong>", $comment_post_link." ".$comment_link ); ?></h4>
<p class="comment-author"><?php comment_author_link(); ?></p>
<?php endif; // comment_type ?>
<blockquote><p><?php comment_excerpt(); ?></p></blockquote>
<p class="row-actions"><?php echo $actions_string; ?></p>
</div>
</div>
<?php
}
示例6: qbar_recent_comments
/**
* Display Recent Comments
*
* @since Fastfood 0.37
*/
function qbar_recent_comments()
{
$args = array('status' => 'approve', 'number' => apply_filters('fastfood_filter_get_recentcomments_number', absint(FastfoodOptions::get_opt('fastfood_qbar_reccom_length'))), 'type' => 'comment');
$comments = get_comments($args);
// valid type values (not documented) : 'pingback','trackback','comment'
if ($comments) {
?>
<ul class="solid_ul">
<?php
foreach ($comments as $comment) {
//if( post_password_required( get_post( $comment->comment_post_ID ) ) ) { continue; } // uncomment to skip comments on protected posts. Hi Emma ;)
$post = get_post($comment->comment_post_ID);
setup_postdata($post);
$post_title_short = mb_strimwidth(get_the_title($post->ID), 0, 35, '…');
if (post_password_required($post)) {
//hide comment author in protected posts
$com_auth = __('someone', 'fastfood');
} else {
//trim the comment author if > 20 chars
$com_auth = mb_strimwidth($comment->comment_author, 0, 20, '…');
}
?>
<li>
<?php
echo sprintf('<span class="label">' . apply_filters('fastfood_filter_comment_by', __('%1$s about %2$s', 'fastfood')) . '</span>', $com_auth, fastfood_build_link(array('href' => get_comment_link($comment), 'text' => $post_title_short)));
?>
<div class="quickbar-panel-subcontent">
<div class="quickbar-panel-title"><i class="el-icon-eye-open"></i></div>
<div class="preview">
<?php
if (post_password_required($post)) {
echo '<i class="el-icon-lock"></i> [' . __('No preview: this is a comment of a protected post', 'fastfood') . ']';
} else {
echo get_avatar($comment, 32);
comment_excerpt($comment->comment_ID);
}
?>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
} else {
?>
<ul>
<li><?php
_e('No comments yet.', 'fastfood');
?>
</li>
</ul>
<?php
}
wp_reset_postdata();
}
示例7: _wp_dashboard_recent_comments_row
//.........这里部分代码省略.........
}
if ('1' === $comment->comment_approved) {
$actions['view'] = '<a class="comment-link" href="' . esc_url(get_comment_link($comment)) . '">' . _x('View', 'verb') . '</a>';
}
/**
* Filter the action links displayed for each comment in the 'Recent Comments'
* dashboard widget.
*
* @since 2.6.0
*
* @param array $actions An array of comment actions. Default actions include:
* 'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
* 'Delete', and 'Trash'.
* @param WP_Comment $comment The comment object.
*/
$actions = apply_filters('comment_row_actions', array_filter($actions), $comment);
$i = 0;
foreach ($actions as $action => $link) {
++$i;
('approve' == $action || 'unapprove' == $action) && 2 === $i || 1 === $i ? $sep = '' : ($sep = ' | ');
// Reply and quickedit need a hide-if-no-js span
if ('reply' == $action || 'quickedit' == $action) {
$action .= ' hide-if-no-js';
}
$actions_string .= "<span class='{$action}'>{$sep}{$link}</span>";
}
}
?>
<div id="comment-<?php
echo $comment->comment_ID;
?>
" <?php
comment_class(array('comment-item', wp_get_comment_status($comment)), $comment);
?>
>
<?php
echo get_avatar($comment, 50, 'mystery');
?>
<?php
if (!$comment->comment_type || 'comment' == $comment->comment_type) {
?>
<div class="dashboard-comment-wrap has-row-actions">
<h4 class="comment-meta">
<?php
if ($comment_post_link) {
printf(__('From %1$s on %2$s%3$s'), '<cite class="comment-author">' . get_comment_author_link($comment) . '</cite>', $comment_post_link, ' <span class="approve">' . __('[Pending]') . '</span>');
} else {
printf(__('From %1$s %2$s'), '<cite class="comment-author">' . get_comment_author_link($comment) . '</cite>', ' <span class="approve">' . __('[Pending]') . '</span>');
}
?>
</h4>
<?php
} else {
switch ($comment->comment_type) {
case 'pingback':
$type = __('Pingback');
break;
case 'trackback':
$type = __('Trackback');
break;
default:
$type = ucwords($comment->comment_type);
}
$type = esc_html($type);
?>
<div class="dashboard-comment-wrap has-row-actions">
<?php
/* translators: %1$s is type of comment, %2$s is link to the post */
?>
<h4 class="comment-meta"><?php
printf(_x('%1$s on %2$s', 'dashboard'), "<strong>{$type}</strong>", $comment_post_link);
?>
</h4>
<p class="comment-author"><?php
comment_author_link($comment);
?>
</p>
<?php
}
// comment_type
?>
<blockquote><p><?php
comment_excerpt($comment);
?>
</p></blockquote>
<p class="row-actions"><?php
echo $actions_string;
?>
</p>
</div>
</div>
<?php
$GLOBALS['comment'] = null;
}
示例8: get_comments
$comments = get_comments('post_id=' . get_the_ID());
$trackbacks_number = 0;
foreach ($comments as $comment) {
if ($comment->comment_type == "trackback" || $comment->comment_type == "pingback") {
?>
<li id="comment-<?php
comment_ID();
?>
" class="group">
<cite><?php
comment_author_link();
?>
</cite>
<br/>
<?php
comment_excerpt();
?>
</li>
<?php
$trackbacks_number++;
}
}
?>
</ol>
<?php
if ($trackbacks_number == 0) {
?>
<p><em><?php
_e('No trackback or pingback available for this article.', 'yit');
?>
</em></p><?php
示例9: widget
public function widget($args, $instance)
{
global $comments, $comment;
$cache = array();
if (!$this->is_preview()) {
$cache = wp_cache_get('widget_recent_comments', 'widget');
}
if (!is_array($cache)) {
$cache = array();
}
if (!isset($args['widget_id'])) {
$args['widget_id'] = $this->id;
}
if (isset($cache[$args['widget_id']])) {
echo balanceTags($cache[$args['widget_id']]);
return;
}
$output = '';
$title = !empty($instance['title']) ? $instance['title'] : __('Recent Comments', ST_TEXTDOMAIN);
/** This filter is documented in wp-includes/default-widgets.php */
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
$number = !empty($instance['number']) ? absint($instance['number']) : 5;
if (!$number) {
$number = 5;
}
/**
* Filter the arguments for the Recent Comments widget.
*
* @since 3.4.0
*
* @see get_comments()
*
* @param array $comment_args An array of arguments used to retrieve the recent comments.
*/
$comments = get_comments(apply_filters('widget_comments_args', array('number' => $number, 'status' => 'approve', 'post_status' => 'publish')));
$output .= $args['before_widget'];
if ($title) {
$output .= $args['before_title'] . $title . $args['after_title'];
}
$output .= '<ul class="thumb-list thumb-list-right">';
if ($comments) {
// Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)
$post_ids = array_unique(wp_list_pluck($comments, 'comment_post_ID'));
_prime_post_caches($post_ids, strpos(get_option('permalink_structure'), '%category%'), false);
foreach ((array) $comments as $comment) {
$avatar = st_get_profile_avatar($comment->user_id, 50);
$output .= '<li class="recentcomments">';
$output .= '
' . $avatar . '
';
$output .= '<div class="thumb-list-item-caption">
<p class="thumb-list-item-meta"><a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">' . human_time_diff(get_comment_time('U'), current_time('timestamp')) . __(' ago', ST_TEXTDOMAIN) . '</a> </p>
<h4 class="thumb-list-item-title">
' . sprintf(__('%s', ST_TEXTDOMAIN), sprintf('<cite class="fn">%s</cite>', get_comment_author_link())) . '
</h4>
</div>';
ob_start();
comment_excerpt();
$comment_excerpt = @ob_get_clean();
$output .= '<p class="thumb-list-item-desciption">' . $comment_excerpt . '</p>';
$output .= '</li>';
}
}
$output .= '</ul>';
$output .= $args['after_widget'];
echo balanceTags($output);
if (!$this->is_preview()) {
$cache[$args['widget_id']] = $output;
wp_cache_set('widget_recent_comments', $cache, 'widget');
}
}
示例10: widget
//.........这里部分代码省略.........
<?php
}
?>
</ul>
<?php
}
// End popular posts check.
?>
<?php
if (0 < $args['recent_comments_number']) {
?>
<?php
$comments = get_comments(array('number' => $args['recent_comments_number'], 'status' => 'approve'));
?>
<?php
if (!empty($comments)) {
?>
<ul id="<?php
echo esc_attr($this->id_base);
?>
-comments" class="tabs-panel">
<?php
foreach ($comments as $comment) {
?>
<li>
<div class="tab-thumbnail avatar">
<?php
printf('<a href="%s">%s</a>', esc_url(get_comment_link($comment->comment_ID)), get_avatar($comment->comment_author_email, 96));
?>
</div>
<div class="tab-content">
<div class="tab-author">
<cite><?php
comment_author($comment->comment_ID);
?>
</cite>
</div>
<div class="tab-comment">
<a href="<?php
echo esc_url(get_comment_link($comment->comment_ID));
?>
">
<?php
comment_excerpt($comment->comment_ID);
?>
</a>
</div>
</div><!-- .tab-content -->
</li>
<?php
}
?>
</ul><!--.tabs-panel-->
<?php
}
// End if have comments check.
?>
<?php
}
// End check for comments display.
?>
<?php
if (0 < $args['tag_cloud_number']) {
?>
<ul id="<?php
echo esc_attr($this->id_base);
?>
-tags" class="tabs-panel">
<li>
<?php
wp_tag_cloud(array('number' => $args['tag_cloud_number']));
?>
</li>
</ul><!-- .tabs-panel -->
<?php
}
// End check for display of tag cloud.
?>
</div><!-- .tabs-container -->
<?php
/* Close the sidebar's widget wrapper. */
echo $sidebar['after_widget'];
}
示例11: wp_dashboard_recent_comments
function wp_dashboard_recent_comments($sidebar_args)
{
global $comment;
extract($sidebar_args, EXTR_SKIP);
echo $before_widget;
echo $before_title;
echo $widget_name;
echo $after_title;
$lambda = create_function('', 'return 5;');
add_filter('option_posts_per_rss', $lambda);
// hack - comments query doesn't accept per_page parameter
$comments_query = new WP_Query('feed=rss2&withcomments=1');
remove_filter('option_posts_per_rss', $lambda);
$is_first = true;
if ($comments_query->have_comments()) {
while ($comments_query->have_comments()) {
$comments_query->the_comment();
$comment_post_url = get_permalink($comment->comment_post_ID);
$comment_post_title = get_the_title($comment->comment_post_ID);
$comment_post_link = "<a href='{$comment_post_url}'>{$comment_post_title}</a>";
$comment_link = '<a class="comment-link" href="' . get_comment_link() . '">#</a>';
$comment_meta = sprintf(__('From <strong>%1$s</strong> on %2$s %3$s'), get_comment_author(), $comment_post_link, $comment_link);
if ($is_first) {
$is_first = false;
?>
<blockquote><p>“<?php
comment_excerpt();
?>
”</p></blockquote>
<p class='comment-meta'><?php
echo $comment_meta;
?>
</p>
<?php
if ($comments_query->comment_count > 1) {
?>
<ul id="dashboard-comments-list">
<?php
}
// comment_count
} else {
// is_first
?>
<li class='comment-meta'><?php
echo $comment_meta;
?>
</li>
<?php
}
// is_first
}
if ($comments_query->comment_count > 1) {
?>
</ul>
<?php
}
// comment_count;
}
echo $after_widget;
}
示例12: widget
//.........这里部分代码省略.........
</div>
<h2><a href="<?php
the_permalink();
?>
"> <?php
the_title();
?>
</a> </h2>
</div>
</div>
<?php
}
wp_reset_postdata();
?>
</div>
<div class="tab-pane fade" id="popular-tab">
<?php
$count = 5;
$argos = array('posts_per_page' => $count, 'orderby' => 'comment_count');
$loop = new WP_Query($argos);
while ($loop->have_posts()) {
$loop->the_post();
?>
<div class="tab-list clearfix">
<div class="tab-img">
<?php
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url($thumb, 'full');
//get full URL to image (use "large" or "medium" if the images too big)
$image = aq_resize($img_url, 100, 80, true, true, true);
//resize & crop the image
?>
<?php
if ($image) {
?>
<a href="<?php
the_permalink();
?>
"> <img src="<?php
echo $image;
?>
" alt="<?php
the_title();
?>
" /> </a>
<?php
}
?>
</div>
<div class="tab-entry-content">
<div class="entry-meta"> <?php
the_category(', ');
?>
</div>
<h2><a href="<?php
the_permalink();
?>
"> <?php
the_title();
?>
</a> </h2>
</div>
</div>
<?php
}
wp_reset_postdata();
?>
</div>
<div class="tab-pane fade" id="comments-tab">
<?php
$args = array('number' => '5');
$comments = get_comments($args);
foreach ($comments as $comment) {
$url = '<h2><a href="' . get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '" title="' . $comment->comment_author . ' | ' . get_the_title($comment->comment_post_ID) . '">' . $comment->comment_author . '</a>: </h2>';
echo '<div class="com-list clearfix">';
echo '<div class="tab-img">';
echo get_avatar($comment, '64');
echo '</div>';
echo $url;
comment_excerpt($comment->comment_ID);
echo '</div>';
}
?>
</div>
</div>
</div>
<?php
echo $args['after_widget'];
}
示例13: widget
//.........这里部分代码省略.........
echo ot_image_html($the_query_r->post->ID, 60, 60);
?>
</a>
<?php
}
?>
</div>
<div class="text">
<h5><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h5>
<p><a href="<?php
the_permalink();
?>
" class="more-link"><i><?php
_e("Read more", THEME_NAME);
?>
</i></a></p>
</div>
</div>
<?php
}
} else {
?>
<p><?php
_e('No posts where found', THEME_NAME);
?>
</p>
<?php
}
?>
<!-- END .latest-activity -->
</div>
<!-- BEGIN .latest-activity -->
<div class="latest-activity">
<?php
foreach ($comments as $comment) {
if ($comment->user_id && $comment->user_id != "0") {
$authorName = get_the_author_meta('display_name', $comment->user_id);
} else {
$authorName = $comment->comment_author;
}
?>
<div class="activity-item">
<div class="image">
<a href="<?php
echo get_comment_link($comment);
?>
">
<img src="<?php
echo get_avatar_url(get_avatar($comment, 60));
?>
" alt="<?php
echo $authorName;
?>
" />
</a>
</div>
<div class="text">
<h5><a href="<?php
echo get_comment_link($comment);
?>
"><?php
echo $authorName;
?>
</a></h5>
<p><?php
comment_excerpt($comment->comment_ID);
?>
</p>
<p><a href="<?php
echo get_comment_link($comment);
?>
" class="more-link"><i><?php
_e("View article", THEME_NAME);
?>
</i></a></p>
</div>
</div>
<?php
}
?>
<!-- END .latest-activity -->
</div>
</div>
<?php
echo $after_widget;
?>
<?php
}
示例14: widget
public function widget($args, $instance)
{
$cache = get_transient('bunyad_widget_latest_posts');
if (!is_array($cache)) {
$cache = array();
}
if (!isset($args['widget_id'])) {
$args['widget_id'] = $this->id;
}
// cache available
if (!defined('ICL_LANGUAGE_CODE') && isset($cache[$args['widget_id']])) {
echo $cache[$args['widget_id']];
return;
}
ob_start();
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Latest Comments', 'bunyad-widgets') : $instance['title'], $instance, $this->id_base);
if (empty($instance['number']) || !($number = absint($instance['number']))) {
$number = 5;
}
$query = get_comments(apply_filters('bunyad_widget_comments_query_args', array('number' => $number, 'status' => 'approve')));
// do custom loop if available
if (has_action('bunyad_widget_comments_loop')) {
$args['title'] = $title;
do_action('bunyad_widget_comments_loop', array_merge($args, $instance), $query);
} elseif ($query) {
?>
<?php
echo $before_widget;
?>
<?php
if ($title) {
?>
<?php
echo $before_title . $title . $after_title;
?>
<?php
}
?>
<ul class="comments-list">
<?php
foreach ($query as $comment) {
?>
<li class="comment">
<span class="author"><?php
printf('%s said', get_comment_author_link($comment->comment_ID));
?>
</span>
<p class="text"><?php
comment_excerpt($comment->comment_ID);
?>
</p>
<a href=""><?php
echo get_the_title($comment->comment_post_ID);
?>
</a>
</li>
<?php
}
?>
</ul>
<?php
echo $after_widget;
?>
<?php
}
// reset the global $the_post as this query will have stomped on it
wp_reset_postdata();
$cache[$args['widget_id']] = ob_get_flush();
set_transient('bunyad_widget_comments', $cache);
}
示例15: confirm
private function confirm($action)
{
global $comment;
$comment_id = intval($_GET['c']);
$formaction = $action . 'comment';
$nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
$nonce_action .= $comment_id;
if (!($comment = get_comment_to_edit($comment_id))) {
$this->base->ks_die(__('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>', 'edit-comments.php'), '', false);
}
if (!current_user_can('edit_post', $comment->comment_post_ID)) {
$this->base->ks_die('delete' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.'));
}
include dirname(__FILE__) . '/admin-header.php';
switch ($action) {
case 'spam':
$message = __('You are about to mark the following comment as spam:');
break;
case 'trash':
$message = __('You are about to move the following comment to the Trash:', 'ktai_style');
break;
case 'delete':
$message = __('You are about to delete the following comment:');
break;
default:
$message = __('You are about to approve the following comment:');
break;
}
echo '<p><img localsrc="1" alt="" /><font color="red">' . $message . '</font><br />' . __('Are you sure you want to do this?') . '</p>';
?>
<form action="edit-comments.php" method="get">
<?php
$this->admin->sid_field();
?>
<div><input type="submit" value="<?php
_e('No');
?>
" /></div></form>
<form action="comment.php" method="get">
<?php
$this->admin->sid_field();
wp_nonce_field($nonce_action);
?>
<input type="hidden" name="action" value="<?php
echo esc_attr($formaction);
?>
" />
<input type="hidden" name="p" value="<?php
echo intval($comment->comment_post_ID);
?>
" />
<input type="hidden" name="c" value="<?php
echo intval($comment->comment_ID);
?>
" />
<input type="hidden" name="noredir" value="1" />
<div><input type="submit" value="<?php
_e('Yes');
?>
" /></div>
</form>
<dl><dt><img localsrc="<?php
comment_type(68, 112, 112);
?>
" alt="[<?php
comment_type(__('Comment', 'ktai_style'), __('Trackback'), __('Pingback'));
?>
] " /><?php
comment_author();
?>
<img localsrc="46" alt=" @ " /><font color="<?php
echo ks_option('ks_date_color');
?>
"><?php
ks_comment_datetime();
?>
</font></dt><dd><?php
if ($comment->comment_author_email) {
?>
<img localsrc="108" alt="" /><font color="olive"><?php
comment_author_email();
?>
</font><br /><?php
}
if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) {
?>
<img localsrc="112" alt="" /><font color="olive"><?php
comment_author_url();
?>
</font><br /><?php
}
comment_excerpt();
?>
</dd></dl><?php
include dirname(__FILE__) . '/admin-footer.php';
}