• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_comments函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_comments函数的典型用法代码示例。如果您正苦于以下问题:PHP get_comments函数的具体用法?PHP get_comments怎么用?PHP get_comments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_comments函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: alaya_recent_comment

function alaya_recent_comment($number)
{
    $commentNum = 1;
    // Get the comments
    $recent_comments = get_comments(array('number' => $number, 'status' => 'approve', 'type' => 'comment'));
    $commentList = '<ul>';
    foreach ($recent_comments as $comment) {
        $commentList .= '<li>
	             <header class="clearfix">
	                	<figure>
	                        <a href="' . get_permalink($comment->comment_post_ID) . '">
	                            ' . get_avatar($comment->comment_author_email, '40') . '
	                        </a>
	                        <span class="comment-author-name">
	                        ' . $comment->comment_author . '
	                        </span>
	                        <div class="comment-order">' . $commentNum . '</div>
	                    </figure>
	                    
	                    <a class="comment-post" href="' . esc_url(get_permalink($comment->comment_post_ID)) . '#comment-' . esc_attr($comment->comment_ID) . '">
	                       ' . esc_attr(get_the_title($comment->comment_post_ID)) . '
	                    </a>
	                </header>
	                
	                <div class="comment-text">
	                    <div class="up-arrow"></div>
	                	' . wp_trim_words($comment->comment_content, 30) . '
	                </div>
				</li>';
        $commentNum++;
    }
    $commentList .= '</ul>';
    return $commentList;
}
开发者ID:jasmith93,项目名称:cnws,代码行数:34,代码来源:widgets-func.php


示例2: process_refund

 /**
  * Process a refund if supported
  * @param  int $order_id
  * @param  float $amount
  * @param  string $reason
  * @return  bool|wp_error True or false based on success, or a WP_Error object
  */
 public function process_refund($order_id, $amount = null, $reason = '')
 {
     $order = wc_get_order($order_id);
     $transaction_id = null;
     $args = array('post_id' => $order->id, 'approve' => 'approve', 'type' => '');
     remove_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments'));
     $comments = get_comments($args);
     foreach ($comments as $comment) {
         if (strpos($comment->comment_content, 'Transaction ID: ') !== false) {
             $exploded_comment = explode(": ", $comment->comment_content);
             $transaction_id = $exploded_comment[1];
         }
     }
     add_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments'));
     if (!$order || !$transaction_id) {
         return false;
     }
     // Add transaction-specific details to the request
     $transaction_details = array('username' => $this->username, 'password' => $this->password, 'type' => 'refund', 'transactionid' => $transaction_id, 'ipaddress' => $_SERVER['REMOTE_ADDR']);
     if (!is_null($amount)) {
         $transaction_details['amount'] = number_format($amount, 2, '.', '');
     }
     // Send request and get response from server
     $response = $this->post_and_get_response($transaction_details);
     // Check response
     if ($response['response'] == 1) {
         // Success
         $order->add_order_note(__('Inspire Commerce refund completed. Refund Transaction ID: ', 'woocommerce') . $response['transactionid']);
         return true;
     } else {
         // Failure
         $order->add_order_note(__('Inspire Commerce refund error. Response data: ', 'woocommerce') . http_build_query($response));
         return false;
     }
 }
开发者ID:shubham79,项目名称:Jhintaak,代码行数:42,代码来源:gateway-inspire.php


示例3: siiimple_comments

function siiimple_comments($args)
{
    extract($args, EXTR_SKIP);
    echo $before_widget . "\n";
    echo $before_title . 'Recent Comments' . $after_title . "\n";
    $comments = get_comments('status=approve&number=5');
    if ($comments) {
        echo '<ul id="recent_comments">';
        foreach ($comments as $comment) {
            echo '<li><a href="' . get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '" title="' . $comment->comment_author . ' | ' . get_the_title($comment->comment_post_ID) . '">' . get_avatar($comment->comment_author_email, $img_w);
            echo '<span class="recent_comment_name">' . $comment->comment_author . '</span><br/>';
            $comment_string = $comment->comment_content;
            $comment_excerpt = substr($comment_string, 0, 20);
            echo $comment_excerpt;
            if (strlen($comment_excerpt) > 25) {
                echo ' ...';
            }
            echo '</a></li>';
        }
        echo '</ul>';
    } else {
        echo '<ul id="recent_comments">
	          			<li>No Comments Yet</li>
	      				</ul>';
    }
    echo $after_widget . "\n";
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:27,代码来源:widgets-mp.php


示例4: the_content

 /**
  * Add the reaction buttons to the post content.
  * @param  string $content The content HTML
  * @return string The content HTML, with the react buttons attached
  */
 public function the_content($content)
 {
     $post_id = get_the_ID();
     if (!$post_id) {
         return $content;
     }
     $reactions = get_comments(array('post_id' => $post_id, 'type' => 'reaction'));
     $reactions_summary = array();
     foreach ($reactions as $reaction) {
         if (!isset($reactions_summary[$reaction->comment_content])) {
             $reactions_summary[$reaction->comment_content] = 0;
         }
         $reactions_summary[$reaction->comment_content]++;
     }
     $content .= '<div class="emoji-reactions">';
     foreach ($reactions_summary as $emoji => $count) {
         $content .= "<div data-emoji='{$emoji}' data-count='{$count}' data-post='{$post_id}' class='emoji-reaction'><div class='emoji'>{$emoji}</div><div class='count'>{$count}</div></div>";
     }
     if (comments_open($post_id)) {
         /* translators: This is the emoji used for the "Add new emoji reaction" button */
         $content .= "<div data-post='{$post_id}' class='emoji-reaction-add'><div class='emoji'>" . __('😃+', 'react') . '</div></div>';
     }
     $content .= '</div>';
     return $content;
 }
开发者ID:pento,项目名称:react,代码行数:30,代码来源:class-react.php


示例5: wp_count_comments_override

 function wp_count_comments_override($comments, $post_id = 0)
 {
     add_filter('comments_clauses', array('CommentsInterceptor_RS', 'wp_count_comments_clauses'), 99, 2);
     $count = get_comments(array('post_id' => $post_id));
     remove_filter('comments_clauses', array('CommentsInterceptor_RS', 'wp_count_comments_clauses'), 99, 2);
     // remainder of this function ported from WP 3.2 function wp_count_comments()
     $total = 0;
     $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
     foreach ((array) $count as $row) {
         $row = (array) $row;
         // RS modification
         // Don't count post-trashed toward totals
         if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
             $total += $row['num_comments'];
         }
         if (isset($approved[$row['comment_approved']])) {
             $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
         }
     }
     $stats['total_comments'] = $total;
     foreach ($approved as $key) {
         if (empty($stats[$key])) {
             $stats[$key] = 0;
         }
     }
     $stats = (object) $stats;
     return $stats;
 }
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:28,代码来源:comments-interceptor_rs.php


示例6: get

 /**
  * Query the database for specific liveblog entries
  *
  * @param array $args the same args for the core `get_comments()`.
  * @return array array of `WPCOM_Liveblog_Entry` objects with the found entries
  */
 private function get($args = array())
 {
     $defaults = array('post_id' => $this->post_id, 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'type' => $this->key, 'status' => $this->key);
     $args = wp_parse_args($args, $defaults);
     $comments = get_comments($args);
     return self::entries_from_comments($comments);
 }
开发者ID:WaitButWhy,项目名称:www,代码行数:13,代码来源:class-wpcom-liveblog-entry-query.php


示例7: widget

 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 public function widget($args, $instance)
 {
     global $comments, $comment, $woocommerce;
     if ($this->get_cached_widget($args)) {
         return;
     }
     ob_start();
     extract($args);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $number = absint($instance['number']);
     $comments = get_comments(array('number' => $number, 'status' => 'approve', 'post_status' => 'publish', 'post_type' => 'product'));
     if ($comments) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo '<ul class="product_list_widget">';
         foreach ((array) $comments as $comment) {
             $_product = get_product($comment->comment_post_ID);
             $rating = intval(get_comment_meta($comment->comment_ID, 'rating', true));
             $rating_html = $_product->get_rating_html($rating);
             echo '<li><a href="' . esc_url(get_comment_link($comment->comment_ID)) . '">';
             echo $_product->get_image();
             echo $_product->get_title() . '</a>';
             echo $rating_html;
             printf('<span class="reviewer">' . _x('by %1$s', 'by comment author', 'woocommerce') . '</span>', get_comment_author());
             echo '</li>';
         }
         echo '</ul>';
         echo $after_widget;
     }
     $content = ob_get_clean();
     echo $content;
     $this->cache_widget($args, $content);
 }
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:44,代码来源:class-wc-widget-recent-reviews.php


示例8: getWordpressData

    static function getWordpressData() {
        /**
         * Get all global page data
         */
        $blogDataParams = array(
            'url', 'wpurl', 'description', 'rdf_url' , 'rss_url', 'rss2_url'
            , 'atom_url', 'comments_atom_url', 'comments_rss2_url', 'pingback_url'
            , 'stylesheet_url', 'stylesheet_directory', 'template_directory'
            , 'template_url', 'admin_email', 'charset', 'html_type', 'version'
            , 'language', 'text_direction', 'name'
        );

        $blogData = array();

        foreach($blogDataParams as $blogDataParam) {
            $blogData[self::toCamelCase($blogDataParam)] = get_bloginfo($blogDataParam);
        }

        $blogData = array_merge($blogData, array(
            'title'            => wp_title(' | ', false, 'right') . get_bloginfo('name'),
            'archiveLinksHTML' => wp_get_archives('type=monthly&limit=5&format=link&echo=0'),
            'bodyClasses'      => self::getEchoFunctionContents('body_class'),
            'posts'            => array()
        ));

        /**
         * Get posts data
         */
        while (have_posts()) {
            the_post();
            
            $postId     = get_the_ID();

            // Get category data
            $categories = get_the_category();
            $categoryNames = array();
            foreach($categories as $category) {
                array_push($categoryNames, $category->cat_name);
            }

            // Add all relevant post data to the posts array
            array_push(
                $blogData['posts'],
                array_merge(
                    get_object_vars(get_post($postId)),
                    array(
                        'classes'       => get_post_class(),
                        'comments'      => get_comments(array('post_id' => $postId)),
                        'custom'        => get_post_custom(),
                        'permalink'     => get_permalink(),
                        'categories'    => $categories,
                        'categoryNames' => $categoryNames,
                        'categoriesStr' => implode(',', $categoryNames)
                    )
                )
            );
        }

        return $blogData;
    }
开发者ID:nottrobin,项目名称:rw-theme,代码行数:60,代码来源:SitesUtil.php


示例9: get_most_recent_comments

function get_most_recent_comments($args = null)
{
    global $most_recent_comments_args;
    // You can pass any of these arguments as well as any argument supported by get_comments()
    $defaults = array('passworded_posts' => false, 'showpings' => false, 'post_types' => array('post', 'page'), 'post_statuses' => array('publish', 'static'), 'number' => 5, 'status' => 'approve');
    $most_recent_comments_args = wp_parse_args($args, $defaults);
    // Create the cache key
    $key = md5(serialize($most_recent_comments_args));
    $last_changed = wp_cache_get('last_changed', 'comment');
    if (!$last_changed) {
        $last_changed = time();
        wp_cache_set('last_changed', $last_changed, 'comment');
    }
    $cache_key = "most_recent_comments:{$key}:{$last_changed}";
    // Check to see if we already have results for this request
    if ($cache = wp_cache_get($cache_key, 'comment')) {
        return $cache;
    }
    // Modify the get_comments() SQL query
    add_filter('comments_clauses', '_mrc_modify_comments_clauses');
    // Get the comments
    // The custom arguments will be ignored by get_comments()
    $comments = get_comments($most_recent_comments_args);
    // Remove the get_comments() SQL query filter
    remove_filter('comments_clauses', '_mrc_modify_comments_clauses');
    // Cache these results
    wp_cache_add($cache_key, $comments, 'comment');
    return $comments;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:29,代码来源:recent-comments.php


示例10: show_comments_page

function show_comments_page($dbconn, $diary_login)
{
    $nid = (int) $_GET['nid'];
    // Get Note
    $sql = "SELECT u.uid, n.* FROM " . TABLE_USERS . " AS u, " . TABLE_NOTES . " AS n WHERE u.login='" . $diary_login . "' AND n.uid=u.uid AND n.nid='" . $nid . "' LIMIT 1";
    $result = pg_query($sql) or die(pg_last_error($dbconn));
    if (pg_num_rows($result) == 0) {
        show_error_page($dbconn, $diary_login, "no such note!");
        return;
    } else {
        $datanote = pg_fetch_object($result, NULL);
        pg_free_result($result);
        $sql = "SELECT u.uid, s.format_note, s.page_comments, s.format_comment FROM " . TABLE_SETTINGS . " AS s, " . TABLE_USERS . " AS u WHERE u.login='" . $diary_login . "' AND s.uid=u.uid LIMIT 1";
        $result = pg_query($sql) or die(pg_last_error($dbconn));
        $dataformat = pg_fetch_object($result, NULL);
        // Strip link to add comment and number of comments
        $dataformat->format_note = preg_replace('/(<a.* href="{hrefcomment}")(.+)(.*>)/', '', $dataformat->format_note);
        $dataformat->format_note = preg_replace('/(.?{commentscount}.?)/', '', $dataformat->format_note);
        $note = assign_vars($dataformat->format_note, array('{subject}' => $datanote->subject, '{contents}' => $datanote->contents, '{date}' => date("d-m-Y", $datanote->timestamp), '{time}' => date("H:i:s", $datanote->timestamp)));
        $comments = get_comments($dbconn, $diary_login, $dataformat->format_comment, $nid);
        $sql = "SELECT COUNT(c.*) AS commentscount FROM " . TABLE_USERS . " AS u, " . TABLE_COMMENTS . " AS c WHERE c.nid='" . $nid . "' AND c.uid=u.uid AND u.login='" . $diary_login . "'";
        $result = pg_query($sql) or die(pg_last_error($dbconn));
        $datacount = pg_fetch_object($result, NULL);
        pg_free_result($result);
        $commentscount = (int) $datacount->commentscount;
        echo assign_vars($dataformat->page_comments, array('{login}' => $diary_login, '{note}' => $note, '{comments}' => $comments, '{commentscount}' => $commentscount, '{hrefcommentadd}' => 'http://' . $_SERVER['SERVER_NAME'] . '/' . PAGE_COMMENTS . '&nid=' . $nid . '&action=add'));
    }
}
开发者ID:BackupTheBerlios,项目名称:diarusie-svn,代码行数:28,代码来源:comments.inc.php


示例11: anno_internal_comments_get_comments

/**
 * Get a list of comments for a given type
 * 
 * @param string $type Type of comments to fetch
 * @return array Array of comment objects
 */
function anno_internal_comments_get_comments($type, $post_id)
{
    remove_filter('comments_clauses', 'anno_internal_comments_clauses');
    $comments = get_comments(array('type' => $type, 'post_id' => $post_id));
    add_filter('comments_clauses', 'anno_internal_comments_clauses');
    return $comments;
}
开发者ID:nameofname,项目名称:momo-wordpress-theme,代码行数:13,代码来源:internal-comments.php


示例12: gen_comment_msg

function gen_comment_msg($t, $id)
{
    $comments = get_comments($t, $id);
    $msg = html_of_speaker($id) . "\n";
    $msg .= html_of_comments($comments) . "\n";
    return $msg;
}
开发者ID:skcho,项目名称:seminar,代码行数:7,代码来源:comment.php


示例13: widget_lmee_by_talk

 function widget_lmee_by_talk($args)
 {
     extract($args);
     echo $before_widget;
     $lmee_popular_options = get_option('widget_lmee_popular');
     $title = '灌水区-这里很热闹';
     //设置默认的标题
     echo $before_title . $title . $after_title;
     $page_ID = 789;
     //用来作为公告栏的页面或者文章id
     $num = 5;
     //显示公告的条数
     echo '<ul class="by_talk">';
     $announcement = '';
     $comments = get_comments("number={$num}&post_id={$page_ID}");
     if (!empty($comments)) {
         $flg = 1;
         foreach ($comments as $comment) {
             if ($flg == 1) {
                 $li_title = $comment->comment_content;
                 if (similar_text($li_title, "<") > 0) {
                     //echo "is";
                     $start = stripos($li_title, "<");
                     //从前往后查找
                     $__li_title = strrev($li_title);
                     //反转字符串
                     $length = strlen($li_title) - $start - stripos($__li_title, ">");
                     $_li_title = substr_replace($li_title, "含引用", $start, $length);
                     $_li_html = substr_replace($li_title, "", $start, $length);
                     $announcement .= '<li class="by-talk-first"><a href="' . get_page_link($page_ID) . '#comment-' . $comment->comment_ID . '" title="' . $_li_title . '" rel="nofollow" target="_blank">' . $_li_html . '</a><br /><span style="color:#999;text-align:right;">(' . get_comment_date('Y/m/d H:i', $comment->comment_ID) . ')</span></li><hr />';
                 } else {
                     //echo "un";
                     $announcement .= '<li class="by-talk-first"><a href="' . get_page_link($page_ID) . '#comment-' . $comment->comment_ID . '" title="' . $li_title . '" rel="nofollow" target="_blank">' . convert_smilies($comment->comment_content) . '</a><br /><span style="color:#999;text-align:right;">(' . get_comment_date('Y/m/d H:i', $comment->comment_ID) . ')</span></li><hr />';
                 }
                 $flg++;
             } else {
                 $li_title = $comment->comment_content;
                 if (similar_text($li_title, "<") > 0) {
                     //echo "is";
                     $start = stripos($li_title, "<");
                     //从前往后查找
                     $__li_title = strrev($li_title);
                     //反转字符串
                     $length = strlen($li_title) - $start - stripos($__li_title, ">");
                     $_li_title = substr_replace($li_title, "含引用", $start, $length);
                     $_li_html = substr_replace($li_title, "", $start, $length);
                     $announcement .= '<li><a href="' . get_page_link($page_ID) . '#comment-' . $comment->comment_ID . '" title="' . $_li_title . '" rel="nofollow" target="_blank">' . $_li_html . '</a><br /><span style="color:#999;text-align:right;">(' . get_comment_date('Y/m/d H:i', $comment->comment_ID) . ')</span></li><hr />';
                 } else {
                     //echo "un";
                     $announcement .= '<li><a href="' . get_page_link($page_ID) . '#comment-' . $comment->comment_ID . '" title="' . $li_title . '" rel="nofollow" target="_blank">' . convert_smilies($comment->comment_content) . '</a><br /><span style="color:#999;text-align:right;">(' . get_comment_date('Y/m/d H:i', $comment->comment_ID) . ')</span></li><hr />';
                 }
             }
         }
     }
     //if ( empty($announcement) ) $announcement = '<li>还没有人灌水奥!</li>';
     echo $announcement;
     echo '</ul>';
     echo "<p style='text-align:right;'>[<a href='" . get_page_link($page_ID) . "#respond' rel='nofollow'>说两句</a>]</p>";
     echo $after_widget;
 }
开发者ID:uglmee,项目名称:kikiku.com,代码行数:60,代码来源:By-talk-for-lmee.php


示例14: widget

 /**
  * Outputs the content for the current Recent Comments widget instance.
  *
  * @param array $args     Display arguments including 'before_title', 'after_title',
  *                        'before_widget', and 'after_widget'.
  * @param array $instance Settings for the current Recent Comments widget instance.
  */
 public function widget($args, $instance)
 {
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     $title = !empty($instance['title']) ? $instance['title'] : __('Recent Comments');
     /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     $number = !empty($instance['number']) ? absint($instance['number']) : 5;
     if (!$number) {
         $number = 5;
     }
     $show_date = isset($instance['show_date']) ? $instance['show_date'] : false;
     /**
      * Filter the arguments for the Recent Comments widget.
      *
      * @since 3.4.0
      *
      * @see WP_Comment_Query::query() for information on accepted arguments.
      *
      * @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')));
     if (is_array($comments) && $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);
         $args['title'] = $title;
         $args['comments'] = $comments;
         $args['show_date'] = $show_date;
         get_template_part_hierarchical_fetch('partials/widgets/recent-comments', '', $args);
         wp_reset_postdata();
     }
 }
开发者ID:e-picas,项目名称:wp-basic-bootstrap,代码行数:41,代码来源:WP_Basic_Bootstrap_Widget_Recent_Comments.php


示例15: findByParentId

 /**
  * Find all comments by a given post ID
  *
  * @access public
  * @param int $commentId
  * @link http://codex.wordpress.org/Function_Reference/get_comments
  * @return array
  */
 public function findByParentId($commentId)
 {
     $args = array('parent' => $commentId);
     $comments = get_comments($args);
     // Convert and return the comments
     return $this->convertAndReturn($comments);
 }
开发者ID:vutran,项目名称:wpmvc-core,代码行数:15,代码来源:CommentRepository.php


示例16: bp_core_action_delete_user

/**
 * Process user deletion requests.
 *
 * Note: No longer called here. See the Settings component.
 */
function bp_core_action_delete_user()
{
    $userID = bp_displayed_user_id();
    echo "Buddypress:";
    echo $userID;
    $now = current_time('mysql');
    $args = array('date_query' => array('after' => '5 minute ago', 'before' => $now, 'inclusive' => true), 'post_id' => $postID, 'user_id' => $userID, 'count' => true);
    $userActivityCount = get_comments($args);
    if (!bp_current_user_can('bp_moderate') || bp_is_my_profile() || !bp_displayed_user_id() || $userActivityCount != 0) {
        return false;
    }
    if (bp_is_current_component('admin') && bp_is_current_action('delete-user') && $userActivityCount == 0) {
        // Check the nonce.
        check_admin_referer('delete-user');
        $errors = false;
        $style = "<style> #account-delete-form .submit{ display:none !important;} </style>";
        if ($userActivityCount != 0) {
            $errors = true;
            return $style;
        }
        do_action('bp_core_before_action_delete_user', $errors);
        if (bp_core_delete_account(bp_displayed_user_id()) || $userActivityCount == 0) {
            bp_core_add_message(sprintf(__('%s has been deleted from the system.', 'buddypress'), bp_get_displayed_user_fullname()));
        } else {
            bp_core_add_message(sprintf(__('There was an error deleting %s from the system. Please try again.', 'buddypress'), bp_get_displayed_user_fullname()), 'error');
            $errors = true;
        }
        do_action('bp_core_action_delete_user', $errors);
        if ($errors) {
            bp_core_redirect(bp_displayed_user_domain());
        } else {
            bp_core_redirect(bp_loggedin_user_domain());
        }
    }
}
开发者ID:ashpriom,项目名称:wp-auction,代码行数:40,代码来源:bp-members-actions.php


示例17: show_comments

function show_comments($root_comment, $is_outer)
{
    $children = get_comments(array('parent' => $root_comment->comment_ID));
    // 子コメントでかつ最も外側で読んでいる場合は表示しない
    if ($root_comment->comment_parent != '0' && $is_outer) {
        return;
    }
    if (!is_null($children)) {
        $children_coutput = '<ul class="mdl-list comments child">';
        foreach ($children as $cc) {
            $children_coutput = $children_coutput . show_comments($cc, false);
        }
        $children_coutput = $children_coutput . '</ul>';
    }
    $home_url = home_url();
    $author = empty($root_comment->comment_author) ? '匿名' : $root_comment->comment_author;
    $output = <<<HTML
<li class="mdl-list__item mdl-list__item--three-line" id="{$root_comment->comment_ID}">
  <span class="mdl-list__item-primary-content">
    <i class="material-icons mdl-list__item-avatar">person</i>
    <span class="author">{$author}</span>
    <span class="mdl-list__item-text-body">{$root_comment->comment_content}</span>
    {$children_coutput}
  </span>
  <span class="mdl-list__item-secondary-content reply">
    <button data-replytocom="{$root_comment->comment_ID}" data-commentauthor="{$author}" class="replytocom mdl-list__item-secondary-action mdl-button mdl-js-button mdl-button--icon" rel='nofollow'>
       <i class="material-icons">reply</i>
    </button>
  </span>
</li>
HTML;
    return $output;
}
开发者ID:vsanna,项目名称:blog,代码行数:33,代码来源:functions.php


示例18: widget

 function widget($args, $instance)
 {
     if (!isset($args['widget_id'])) {
         $args['widget_id'] = $this->id;
     }
     $output = '';
     $title = !empty($instance['title']) ? $instance['title'] : __('Recent Comments');
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     $number = !empty($instance['number']) ? absint($instance['number']) : 5;
     if (!$number) {
         $number = 5;
     }
     $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 id="recentcomments">';
     if (is_array($comments) && $comments) {
         $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) {
             $title = get_the_title($comment->comment_post_ID);
             $output .= '<li class="recentcomments"><i class="fa fa-comments">&nbsp;</i> ';
             $output .= sprintf(_x('%1$s on %2$s', 'widgets'), '<span class="comment-author-link"><strong> ' . get_comment_author_link($comment) . '</strong></span>', '<br><a href="' . esc_url(get_comment_link($comment)) . '">' . $title . '</a>');
             $output .= '</li>';
         }
     }
     $output .= '</ul>';
     $output .= $args['after_widget'];
     echo $output;
 }
开发者ID:de190909,项目名称:WPTest,代码行数:32,代码来源:class-extend-recent-comments-widget.php


示例19: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if (!is_callable('get_comments')) {
         include_once ABSPATH . WPINC . '/wp-includes/comment.php';
     }
     if (!is_callable('get_comments')) {
         return new WP_Error('missing-function-get_comments', 'Due to an unknown issue, the wp_comments function is not available.');
     }
     $comments = get_comments($arguments['args']);
     if (is_array($comments)) {
         $this->response['comments'] = array();
         foreach ($comments as $index => $comment) {
             $this->response['comments'][$comment->comment_ID] = (array) $comment;
         }
         if ($arguments['include-parent-details']) {
             $this->add_parent_details();
         }
         if ($arguments['include-post-details']) {
             $this->add_post_details();
         }
         if ($arguments['include-user-details']) {
             $this->add_user_details();
         }
     } else {
         $this->response = $comments;
     }
     return $this->response;
 }
开发者ID:jimlongo56,项目名称:rdiv,代码行数:29,代码来源:get-comment-details.php


示例20: widget_lmee_notice

 function widget_lmee_notice($args)
 {
     extract($args);
     echo $before_widget;
     $lmee_popular_options = get_option('widget_lmee_popular');
     $title = '小家伙说的话(NOTICE)';
     //设置默认的标题
     echo $before_title . $title . $after_title;
     $page_ID = 515;
     //用来作为公告栏的页面或者文章id
     $num = 2;
     //显示公告的条数
     echo '<ul class="notice" style="padding: 1em 1.4em;">';
     $announcement = '';
     $comments = get_comments("number={$num}&post_id={$page_ID}");
     if (!empty($comments)) {
         foreach ($comments as $comment) {
             $announcement .= '<li>' . convert_smilies($comment->comment_content) . ' <span style="color:#999;">(' . get_comment_date('y/m/d', $comment->comment_ID) . ')</span></li>';
         }
     }
     if (empty($announcement)) {
         $announcement = '<li>欢迎来到 LMEE!</li>';
     }
     echo $announcement;
     echo '</ul>';
     if (is_user_logged_in()) {
         echo '<p style="text-align:right;"><a href="' . get_page_link($page_ID) . '#respond" rel="nofollow">发表公告</a></p>';
     }
     echo $after_widget;
 }
开发者ID:uglmee,项目名称:kikiku.com,代码行数:30,代码来源:Notice-for-lmee.php



注:本文中的get_comments函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_comments_link函数代码示例发布时间:2022-05-15
下一篇:
PHP get_commentdata函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap