本文整理汇总了PHP中get_comment_type函数的典型用法代码示例。如果您正苦于以下问题:PHP get_comment_type函数的具体用法?PHP get_comment_type怎么用?PHP get_comment_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_comment_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: omega_comments_callback
/**
* Uses the $comment_type to determine which comment template should be used. Once the
* template is located, it is loaded for use. Child themes can create custom templates based off
* the $comment_type. The comment template hierarchy is comment-$comment_type.php,
* comment.php.
*
* The templates are saved in $omega->comment_template[$comment_type], so each comment template
* is only located once if it is needed. Following comments will use the saved template.
*
* @since 0.2.3
* @access public
* @param $comment The comment object.
* @param $args Array of arguments passed from wp_list_comments().
* @param $depth What level the particular comment is.
* @return void
*/
function omega_comments_callback($comment, $args, $depth)
{
global $omega;
/* Get the comment type of the current comment. */
$comment_type = get_comment_type($comment->comment_ID);
/* Create an empty array if the comment template array is not set. */
if (!isset($omega->comment_template) || !is_array($omega->comment_template)) {
$omega->comment_template = array();
}
/* Check if a template has been provided for the specific comment type. If not, get the template. */
if (!isset($omega->comment_template[$comment_type])) {
/* Create an array of template files to look for. */
$templates = array("comment-{$comment_type}.php", "comment/{$comment_type}.php");
/* If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'. */
if ('pingback' == $comment_type || 'trackback' == $comment_type) {
$templates[] = 'comment-ping.php';
$templates[] = 'comment/ping.php';
}
/* Add the fallback 'comment.php' template. */
$templates[] = 'comment/comment.php';
$templates[] = 'comment.php';
/* Allow devs to filter the template hierarchy. */
$templates = apply_filters('omega_comment_template_hierarchy', $templates, $comment_type);
/* Locate the comment template. */
$template = locate_template($templates);
/* Set the template in the comment template array. */
$omega->comment_template[$comment_type] = $template;
}
/* If a template was found, load the template. */
if (!empty($omega->comment_template[$comment_type])) {
require $omega->comment_template[$comment_type];
}
}
示例2: sf_custom_comments
function sf_custom_comments($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
$GLOBALS['comment_depth'] = $depth;
?>
<li id="comment-<?php
comment_ID();
?>
" <?php
comment_class('clearfix');
?>
>
<div class="comment-wrap clearfix">
<div class="comment-avatar">
<?php
if (function_exists('get_avatar')) {
echo get_avatar($comment, '100');
}
?>
<?php
if ($comment->comment_author_email == get_the_author_meta('email')) {
?>
<span class="tooltip"><?php
_e("Author", "swiftframework");
?>
<span class="arrow"></span></span>
<?php
}
?>
</div>
<div class="comment-content">
<div class="comment-meta">
<?php
printf('<span class="comment-author">%1$s</span> <span class="comment-date">%2$s</span>', get_comment_author_link(), human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ' . __("ago", "swiftframework"));
?>
<div class="comment-meta-actions">
<?php
edit_comment_link(__('Edit', 'swiftframework'), '<span class="edit-link">', '</span><span class="meta-sep"> |</span>');
?>
<?php
if ($args['type'] == 'all' || get_comment_type() == 'comment') {
comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'swiftframework'), 'login_text' => __('Log in to reply.', 'swiftframework'), 'depth' => $depth, 'before' => '<span class="comment-reply">', 'after' => '</span>')));
}
?>
</div>
</div>
<?php
if ($comment->comment_approved == '0') {
_e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'swiftframework');
}
?>
<div class="comment-body">
<?php
comment_text();
?>
</div>
</div>
</div>
<?php
}
示例3: carelib_comments_callback
/**
* Uses the $comment_type to determine which comment template should be used.
* Once the template is located, it is loaded for use.
*
* Child themes can create custom templates based off the $comment_type. The
* comment template hierarchy is comment-$comment_type.php, comment.php.
*
* Templates are saved in CareLib_Template_Comments::comment_template[$comment_type],
* so each comment template is only located once if it is needed. The
* following comments will use the saved template.
*
* @since 1.0.0
* @access public
* @param object $comment the comment object.
* @param array $args list of arguments passed from wp_list_comments().
* @param integer $depth What level the particular comment is.
* @return void
*/
function carelib_comments_callback($comment, $args, $depth)
{
static $comment_template = array();
// Get the comment type of the current comment.
$comment_type = get_comment_type($comment->comment_ID);
// Check if a template has been provided for the specific comment type. If not, get the template.
if (!isset($comment_template[$comment_type])) {
// Create an array of template files to look for.
$templates = array("template-parts/comment/{$comment_type}.php", "comment-{$comment_type}.php");
// If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'.
if ('pingback' === $comment_type || 'trackback' === $comment_type) {
$templates[] = 'template-parts/comment/ping.php';
$templates[] = 'comment-ping.php';
}
// Add the fallback 'comment.php' template.
$templates[] = 'template-parts/comment/comment.php';
$templates[] = 'comment.php';
// Allow devs to filter the template hierarchy.
$templates = apply_filters("{$GLOBALS['carelib_prefix']}_comment_template_hierarchy", $templates, $comment_type);
// Locate the comment template.
$template = locate_template($templates);
// Set the template in the comment template array.
$comment_template[$comment_type] = $template;
}
// If a template was found, load the template.
if (!empty($comment_template[$comment_type])) {
require $comment_template[$comment_type];
}
}
示例4: hybrid_comments_callback
/**
* Uses the `$comment_type` to determine which comment template should be used. Once the
* template is located, it is loaded for use. Child themes can create custom templates based off
* the `$comment_type`. The comment template hierarchy is `comment-$comment_type.php`,
* `comment.php`.
*
* The templates are saved in `$hybrid->comment_template[$comment_type]`, so each comment template
* is only located once if it is needed. Following comments will use the saved template.
*
* @since 0.2.3
* @access public
* @global object $hybrid
* @param object $comment
* @return void
*/
function hybrid_comments_callback($comment)
{
global $hybrid;
// Get the comment type of the current comment.
$comment_type = get_comment_type($comment->comment_ID);
// Create an empty array if the comment template array is not set.
if (!isset($hybrid->comment_template) || !is_array($hybrid->comment_template)) {
$hybrid->comment_template = array();
}
// Check if a template has been provided for the specific comment type. If not, get the template.
if (!isset($hybrid->comment_template[$comment_type])) {
// Create an array of template files to look for.
$templates = array("comment-{$comment_type}.php", "comment/{$comment_type}.php");
// If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'.
if ('pingback' == $comment_type || 'trackback' == $comment_type) {
$templates[] = 'comment-ping.php';
$templates[] = 'comment/ping.php';
}
// Add the fallback 'comment.php' template.
$templates[] = 'comment/comment.php';
$templates[] = 'comment.php';
// Allow devs to filter the template hierarchy.
$templates = apply_filters('hybrid_comment_template_hierarchy', $templates, $comment_type);
// Locate the comment template.
$template = locate_template($templates);
// Set the template in the comment template array.
$hybrid->comment_template[$comment_type] = $template;
}
// If a template was found, load the template.
if (!empty($hybrid->comment_template[$comment_type])) {
require $hybrid->comment_template[$comment_type];
}
}
示例5: sandbox_trackbacks
function sandbox_trackbacks($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
global $sandbox_comment_alt;
?>
<?php
if (get_comment_type() != "comment") {
?>
<li id="comment-<?php
comment_ID();
?>
" class="<?php
sandbox_comment_class();
?>
">
<div class="comment-author"><?php
printf(__('By %1$s on %2$s at %3$s', 'sandbox'), get_comment_author_link(), get_comment_date(), get_comment_time());
edit_comment_link(__('Edit', 'sandbox'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>');
?>
</div>
<?php
if ($comment->comment_approved == '0') {
_e('\\t\\t\\t\\t\\t<span class="unapproved">Your trackback is awaiting moderation.</span>\\n', 'sandbox');
}
?>
<?php
comment_text();
?>
</li>
<?php
}
}
示例6: momtaz_comments_callback
/**
* Uses the $comment_type to determine which comment template should be used. Once the
* template is located, it is loaded for use.
*
* @since 1.0
* @param $comment The comment variable
* @param $args Array of arguments passed from wp_list_comments()
* @param $depth What level the particular comment is
*/
function momtaz_comments_callback($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
$GLOBALS['comment_depth'] = $depth;
$GLOBALS['max_depth'] = $args['max_depth'];
// Locate the template based on the $comment_type. Default to 'comment.php'.
momtaz_template_part('comment', get_comment_type($comment->comment_ID));
}
示例7: thematic_comments
/**
* Custom callback function to list comments in the Thematic style.
*
* If you want to use your own comments callback for wp_list_comments, filter list_comments_arg
*
* @param object $comment
* @param array $args
* @param int $depth
*/
function thematic_comments($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
$GLOBALS['comment_depth'] = $depth;
?>
<li id="comment-<?php
comment_ID();
?>
" <?php
comment_class();
?>
>
<?php
// action hook for inserting content above #comment
thematic_abovecomment();
?>
<div class="comment-author vcard"><?php
thematic_commenter_link();
?>
</div>
<?php
thematic_commentmeta(TRUE);
?>
<?php
if ($comment->comment_approved == '0') {
echo "\t\t\t\t\t" . '<span class="unapproved">';
_e('Your comment is awaiting moderation', 'thematic');
echo ".</span>\n";
}
?>
<div class="comment-content">
<?php
comment_text();
?>
</div>
<?php
// echo the comment reply link with help from Justin Tadlock http://justintadlock.com/ and Will Norris http://willnorris.com/
if ($args['type'] == 'all' || get_comment_type() == 'comment') {
comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'thematic'), 'login_text' => __('Log in to reply.', 'thematic'), 'depth' => $depth, 'before' => '<div class="comment-reply-link">', 'after' => '</div>')));
}
?>
<?php
// action hook for inserting content above #comment
thematic_belowcomment();
?>
<?php
}
示例8: get_comment_type_label
public static function get_comment_type_label($comment_id)
{
$comment_type = get_comment_type($comment_id);
if (empty($comment_type)) {
$comment_type = 'comment';
}
$comment_type_labels = self::get_comment_type_labels();
$label = isset($comment_type_labels[$comment_type]) ? $comment_type_labels[$comment_type] : $comment_type;
return $label;
}
示例9: wpi_get_comment_text_filter
function wpi_get_comment_text_filter($content)
{
global $comment;
$type = get_comment_type();
if ($type != 'comment') {
$htm = call_user_func_array('wpi_' . $type . '_footer', array($comment));
if (!empty($htm)) {
$content .= _t('span', $htm, array('class' => 'db cb cf comment-footer'));
}
}
return $content;
}
示例10: get_ping_type
function get_ping_type($trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback')
{
$type = get_comment_type();
switch ($type) {
case 'trackback':
return $trackbacktxt;
break;
case 'pingback':
return $pingbacktxt;
break;
}
return false;
}
示例11: constructent_comment_callback
/**
* Template for comments and pingbacks.
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @param string $comment
* @param array $args
* @param int $depth
*
* @see wp_list_comments()
*
* @return void
*/
function constructent_comment_callback($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
$comment_type = get_comment_type($comment->comment_ID);
$templates = array("comment-{$comment_type}.php");
// If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'
if ('pingback' == $comment_type || 'trackback' == $comment_type) {
$templates[] = 'comment-ping.php';
}
// Add the fallback 'comment.php' template
$templates[] = 'comment.php';
if ($template = locate_template($templates)) {
include $template;
}
}
示例12: pl_recent_comments
function pl_recent_comments($number = 3)
{
$comments = get_comments(array('number' => $number, 'status' => 'approve'));
if ($comments) {
foreach ((array) $comments as $comment) {
if ('comment' != get_comment_type($comment)) {
continue;
}
$post = get_post($comment->comment_post_ID);
$link = get_comment_link($comment->comment_ID);
$avatar = pl_get_avatar_url(get_avatar($comment));
$img = $avatar ? sprintf('<div class="img rtimg"><a class="the-media" href="%s" style="background-image: url(%s)"></a></div>', $link, $avatar) : '';
printf('<li class="media fix">%s<div class="bd"><div class="the-quote pl-contrast"><div class="title" >"%s"</div><div class="excerpt">on <a href="%s">%s</a></div></div></div></li>', $img, stripslashes(substr(wp_filter_nohtml_kses($comment->comment_content), 0, 50)), $link, custom_trim_excerpt($post->post_title, 3));
}
}
}
示例13: custom_comments
function custom_comments($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
$GLOBALS['comment_depth'] = $depth;
?>
<li id="comment-<?php
comment_ID();
?>
" <?php
comment_class();
?>
>
<div class="comment-author vcard"><?php
commenter_link();
?>
</div>
<div class="comment-meta"><?php
printf(__('Posted %1$s at %2$s <span class="meta-sep">|</span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'your-theme'), get_comment_date(), get_comment_time(), '#comment-' . get_comment_ID());
edit_comment_link(__('Edit', 'your-theme'), ' <span class="meta-sep">|</span> <span class="edit-link">', '</span>');
?>
</div>
<div class="comment-content">
<?php
comment_text();
?>
</div>
<?php
// echo the comment reply link
if ($args['type'] == 'all' || get_comment_type() == 'comment') {
comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'your-theme'), 'login_text' => __('Log in to reply.', 'your-theme'), 'depth' => $depth, 'before' => '<div class="comment-reply-link">', 'after' => '</div>')));
}
?>
<?php
if ($comment->comment_approved == '0') {
_e("\t\t\t\t\t<span class='info'>Your comment is awaiting moderation.</span>\n", 'your-theme');
}
?>
<?php
}
示例14: gplus_custom_pings
function gplus_custom_pings($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
if ('pingback' == get_comment_type()) {
$pingtype = 'Pingback';
} else {
$pingtype = 'Trackback';
}
?>
<li> <?php
comment_author_link();
?>
- <?php
echo $pingtype;
?>
on <?php
echo mysql2date('Y/m/d/ H:i', $comment->comment_date);
}
示例15: highlight_comment
function highlight_comment()
{
global $comment, $user_email, $comment_author_email, $posts;
$authordata = get_userdata($posts[0]->post_author);
get_currentuserinfo();
if ($comment->comment_author_email and get_comment_type() == 'comment') {
if ($comment->comment_author_email == $authordata->user_email) {
//highlight author
echo 'class="author-comment"';
} elseif ($comment->comment_author_email == $user_email) {
//highlight user if not author
echo 'class="user-comment"';
} elseif ($comment->comment_author_email == $comment_author_email) {
//highlight commenter if not user
echo 'class="user-comment"';
}
}
if (get_comment_type() != 'comment') {
echo 'class="ping-comment"';
}
}