本文整理汇总了PHP中bbp_topic_voice_count函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_topic_voice_count函数的具体用法?PHP bbp_topic_voice_count怎么用?PHP bbp_topic_voice_count使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_topic_voice_count函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_action
?>
</p>
<?php
do_action('bbp_theme_after_topic_meta');
?>
<?php
bbp_topic_row_actions();
?>
</li>
<li class="bbp-topic-voice-count"><?php
bbp_topic_voice_count();
?>
</li>
<li class="bbp-topic-reply-count"><?php
bbp_show_lead_topic() ? bbp_topic_reply_count() : bbp_topic_post_count();
?>
</li>
<li class="bbp-topic-freshness">
<?php
do_action('bbp_theme_before_topic_freshness_link');
?>
<?php
示例2: test_bbp_get_topic_voice_count
/**
* @covers ::bbp_topic_voice_count
* @covers ::bbp_get_topic_voice_count
*/
public function test_bbp_get_topic_voice_count()
{
$u = $this->factory->user->create_many(2);
$f = $this->factory->forum->create();
$t = $this->factory->topic->create(array('post_parent' => $f, 'post_author' => $u[0], 'topic_meta' => array('forum_id' => $f)));
$int_value = 2;
$formatted_value = bbp_number_format($int_value);
$this->factory->reply->create_many(3, array('post_parent' => $t, 'post_author' => $u[0], 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
$this->factory->reply->create_many(3, array('post_parent' => $t, 'post_author' => $u[1], 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
bbp_update_topic_voice_count($t);
// Output
$this->expectOutputString($formatted_value);
bbp_topic_voice_count($t);
// Formatted string
$count = bbp_get_topic_voice_count($t, false);
$this->assertSame($formatted_value, $count);
// Integer
$count = bbp_get_topic_voice_count($t, true);
$this->assertSame($int_value, $count);
}
示例3: column_data
/**
* Print extra columns for the topics page
*
* @since 2.0.0 bbPress (r2485)
*
* @param string $column Column
* @param int $topic_id Topic id
* @uses bbp_get_topic_forum_id() To get the forum id of the topic
* @uses bbp_forum_title() To output the topic's forum title
* @uses apply_filters() Calls 'topic_forum_row_actions' with an array
* of topic forum actions
* @uses bbp_get_forum_permalink() To get the forum permalink
* @uses admin_url() To get the admin url of post.php
* @uses bbp_topic_reply_count() To output the topic reply count
* @uses bbp_topic_voice_count() To output the topic voice count
* @uses bbp_topic_author_display_name() To output the topic author name
* @uses get_the_date() Get the topic creation date
* @uses get_the_time() Get the topic creation time
* @uses esc_attr() To sanitize the topic creation time
* @uses bbp_get_topic_last_active_time() To get the time when the topic was
* last active
* @uses do_action() Calls 'bbp_admin_topics_column_data' with the
* column and topic id
*/
public function column_data($column, $topic_id)
{
if ($this->bail()) {
return;
}
// Get topic forum ID
$forum_id = bbp_get_topic_forum_id($topic_id);
// Populate column data
switch ($column) {
// Forum
case 'bbp_topic_forum':
// Output forum name
if (!empty($forum_id)) {
// Forum Title
$forum_title = bbp_get_forum_title($forum_id);
if (empty($forum_title)) {
$forum_title = esc_html__('No Forum', 'bbpress');
}
// Output the title
echo $forum_title;
} else {
esc_html_e('— No forum —', 'bbpress');
}
break;
// Reply Count
// Reply Count
case 'bbp_topic_reply_count':
bbp_topic_reply_count($topic_id);
break;
// Reply Count
// Reply Count
case 'bbp_topic_voice_count':
bbp_topic_voice_count($topic_id);
break;
// Author
// Author
case 'bbp_topic_author':
bbp_topic_author_display_name($topic_id);
break;
// Freshness
// Freshness
case 'bbp_topic_created':
printf('%1$s <br /> %2$s', get_the_date(), esc_attr(get_the_time()));
break;
// Freshness
// Freshness
case 'bbp_topic_freshness':
$last_active = bbp_get_topic_last_active_time($topic_id, false);
if (!empty($last_active)) {
echo esc_html($last_active);
} else {
esc_html_e('No Replies', 'bbpress');
// This should never happen
}
break;
// Do an action for anything else
// Do an action for anything else
default:
do_action('bbp_admin_topics_column_data', $column, $topic_id);
break;
}
}
示例4: single_row
public function single_row($level = 0)
{
global $mode, $post;
static $alternate;
$edit_link = '#';
get_edit_post_link($post->ID);
$title = get_the_title();
$post_type_object = get_post_type_object($post->post_type);
$can_edit_post = false;
// current_user_can( 'edit_post', $post->ID );
$alternate = 'alternate' == $alternate ? '' : 'alternate';
$classes = array($alternate, 'level-0');
?>
<tr id="topic-row-<?php
echo $post->ID;
?>
" <?php
bbp_topic_class($post->ID, $classes);
?>
>
<?php
$forum_id = bbp_get_topic_forum_id($post->ID);
$topic_id = $post->ID;
list($columns, $hidden) = $this->get_column_info();
foreach ($columns as $column_name => $column_display_name) {
$class = "class=\"column-{$column_name}\"";
$style = '';
if (in_array($column_name, $hidden)) {
$style = ' style="display:none;"';
}
$attributes = "{$class}{$style}";
switch ($column_name) {
case 'no':
?>
<td <?php
echo $attributes;
?>
>
<?php
bbp_the_no();
?>
</td>
<?php
break;
case 'title':
$pad = str_repeat('— ', $level);
$title = '<a class="bbp-topic-permalink row-title" href="' . bbp_get_topic_permalink() . '">' . $title . '</a>';
echo "<td {$attributes}>";
do_action('bbp_theme_before_topic_title');
echo $pad . $title;
do_action('bbp_theme_after_topic_title');
echo '</td>';
break;
// Forum
// Forum
case 'forum':
// Output forum name
if (!empty($forum_id)) {
// Forum Title
$forum_title = bbp_get_forum_title($forum_id);
if (empty($forum_title)) {
$forum_title = esc_html__('No Forum', 'bbpress');
}
// Output the title
echo $forum_title;
} else {
esc_html_e('(No Forum)', 'bbpress');
}
break;
// Reply Count
// Reply Count
case 'reply_count':
echo "<td {$attributes}>";
echo '<div class="post-com-count-wrapper"><a class="post-com-count" href="#"><span class="comment-count">';
bbp_topic_reply_count($topic_id);
echo '</span></a></div>';
echo "</td>";
break;
// Reply Count
// Reply Count
case 'voice_count':
echo "<td {$attributes}>";
bbp_topic_voice_count($topic_id);
break;
// Author
// Author
case 'author':
echo "<td {$attributes}>";
bbp_topic_author_display_name($topic_id);
echo "</td>";
break;
// Freshness
// Freshness
case 'date':
echo "<td {$attributes}>";
echo get_the_date('Y.m.d');
echo "</td>";
break;
// Freshness
// Freshness
//.........这里部分代码省略.........