本文整理汇总了PHP中bbp_get_topic_title函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_topic_title函数的具体用法?PHP bbp_get_topic_title怎么用?PHP bbp_get_topic_title使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_topic_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_bbp_get_topic_title
/**
* @covers ::bbp_topic_title
* @covers ::bbp_get_topic_title
*/
public function test_bbp_get_topic_title()
{
$f = $this->factory->forum->create();
$t = $this->factory->topic->create(array('post_title' => 'Topic 1', 'post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
$topic_title = bbp_get_topic_title($t);
$this->assertSame('Topic 1', $topic_title);
}
示例2: test_bbp_insert_topic
/**
* @group canonical
* @covers ::bbp_insert_topic
*/
public function test_bbp_insert_topic()
{
$f = $this->factory->forum->create();
$now = time();
$post_date = date('Y-m-d H:i:s', $now - 60 * 60 * 100);
$t = $this->factory->topic->create(array('post_title' => 'Topic 1', 'post_content' => 'Content for Topic 1', 'post_parent' => $f, 'post_date' => $post_date, 'topic_meta' => array('forum_id' => $f)));
$r = $this->factory->reply->create(array('post_parent' => $t, 'post_date' => $post_date, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
// Get the topic.
$topic = bbp_get_topic($t);
remove_all_filters('bbp_get_topic_content');
// Topic post.
$this->assertSame('Topic 1', bbp_get_topic_title($t));
$this->assertSame('Content for Topic 1', bbp_get_topic_content($t));
$this->assertSame('publish', bbp_get_topic_status($t));
$this->assertSame($f, wp_get_post_parent_id($t));
$this->assertEquals('http://' . WP_TESTS_DOMAIN . '/?topic=' . $topic->post_name, $topic->guid);
// Topic meta.
$this->assertSame($f, bbp_get_topic_forum_id($t));
$this->assertSame(1, bbp_get_topic_reply_count($t, true));
$this->assertSame(0, bbp_get_topic_reply_count_hidden($t, true));
$this->assertSame(1, bbp_get_topic_voice_count($t, true));
$this->assertSame($r, bbp_get_topic_last_reply_id($t));
$this->assertSame($r, bbp_get_topic_last_active_id($t));
$this->assertSame('4 days, 4 hours ago', bbp_get_topic_last_active_time($t));
}
示例3: bbp_format_buddypress_notifications
/**
* Format the BuddyBar/Toolbar notifications
*
* @since 2.5.0 bbPress (r5155)
*
* @package bbPress
*
* @param string $action The kind of notification being rendered
* @param int $item_id The primary item id
* @param int $secondary_item_id The secondary item id
* @param int $total_items The total number of messaging-related notifications waiting for the user
* @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar
*/
function bbp_format_buddypress_notifications($action, $item_id, $secondary_item_id, $total_items, $format = 'string')
{
// Bail if not the notification action we are looking for
if ('bbp_new_reply' !== $action) {
return $action;
}
// New reply notifications
$topic_id = bbp_get_reply_topic_id($item_id);
$topic_title = bbp_get_topic_title($topic_id);
$topic_link = wp_nonce_url(add_query_arg(array('action' => 'bbp_mark_read', 'topic_id' => $topic_id), bbp_get_reply_url($item_id)), 'bbp_mark_topic_' . $topic_id);
$title_attr = __('Topic Replies', 'bbpress');
if ((int) $total_items > 1) {
$text = sprintf(__('You have %d new replies', 'bbpress'), (int) $total_items);
$filter = 'bbp_multiple_new_subscription_notification';
} else {
if (!empty($secondary_item_id)) {
$text = sprintf(__('You have %d new reply to %2$s from %3$s', 'bbpress'), (int) $total_items, $topic_title, bp_core_get_user_displayname($secondary_item_id));
} else {
$text = sprintf(__('You have %d new reply to %s', 'bbpress'), (int) $total_items, $topic_title);
}
$filter = 'bbp_single_new_subscription_notification';
}
// WordPress Toolbar
if ('string' === $format) {
$return = apply_filters($filter, '<a href="' . esc_url($topic_link) . '" title="' . esc_attr($title_attr) . '">' . esc_html($text) . '</a>', (int) $total_items, $text, $topic_link);
// Deprecated BuddyBar
} else {
$return = apply_filters($filter, array('text' => $text, 'link' => $topic_link), $topic_link, (int) $total_items, $text, $topic_title);
}
do_action('bbp_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items);
return $return;
}
示例4: wp_slack_bbpress
/**
* Plugin Name: WP Slack bbPress
* Plugin URI: https://github.com/rolfkleef/wp-slack-bbpress
* Description: Send notifications to Slack channels for events in bbPress.
* Version: 0.5
* Author: Rolf Kleef
* Author URI: https://drostan.org
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-slack-bbpress
*/
function wp_slack_bbpress($events)
{
$events['wp_slack_bbp_new_topic'] = array('action' => 'bbp_new_topic', 'description' => __('When a new topic is added in bbPress', 'wp-slack-bbpress'), 'message' => function ($topic_id, $forum_id, $anonymous_data, $topic_author) {
return array(array('fallback' => sprintf(__('<%1$s|New topic "%2$s"> in forum <%3$s|%4$s>', 'wp-slack-bbpress'), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id)), 'pretext' => sprintf(__('New topic in forum <%1$s|%2$s>', 'wp-slack-bbpress'), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id)), 'author_name' => bbp_get_topic_author_display_name($topic_id), 'author_link' => bbp_get_topic_author_link($topic_id), 'author_icon' => get_avatar_url($topic_author, array('size' => 16)), 'title' => sprintf('%1$s', bbp_get_topic_title($topic_id)), 'title_link' => bbp_get_topic_permalink($topic_id), 'text' => html_entity_decode(bbp_get_topic_excerpt($topic_id, 150))));
});
$events['wp_slack_bbp_new_reply'] = array('action' => 'bbp_new_reply', 'description' => __('When a new reply is added in bbPress', 'wp-slack-bbpress'), 'message' => function ($reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author, $bool, $reply_to) {
return array(array('fallback' => sprintf(__('<%1$s|New reply> in forum <%2$s|%3$s> on topic <%4$s|%5$s>', 'wp-slack-bbpress'), bbp_get_reply_url($reply_id), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id)), 'pretext' => sprintf(__('New reply in forum <%1$s|%2$s> on topic <%3$s|%4$s>', 'wp-slack-bbpress'), bbp_get_forum_permalink($forum_id), bbp_get_forum_title($forum_id), bbp_get_topic_permalink($topic_id), bbp_get_topic_title($topic_id)), 'author_name' => bbp_get_reply_author_display_name($reply_id), 'author_link' => bbp_get_reply_author_link($reply_id), 'author_icon' => get_avatar_url($reply_author, array('size' => 16)), 'title' => sprintf(__('New reply to "%1$s"', 'wp-slack-bbpress'), bbp_get_topic_title($topic_id)), 'title_link' => bbp_get_reply_url($reply_id), 'text' => html_entity_decode(bbp_get_reply_excerpt($reply_id, 150))));
});
return $events;
}
示例5: test_bbp_get_topic_last_reply_title
/**
* @covers ::bbp_topic_last_reply_title
* @covers ::bbp_get_topic_last_reply_title
*/
public function test_bbp_get_topic_last_reply_title()
{
$f = $this->factory->forum->create();
$t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
$title = bbp_get_topic_last_reply_title($t);
$this->assertSame('', $title);
$this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
$title = bbp_get_topic_last_reply_title($t);
$this->assertSame('Reply To: ' . bbp_get_topic_title($t), $title);
}
示例6: reply_title
public static function reply_title($title, $reply_id, $topic_id, $user_id)
{
$subject = get_option('_bbp_reply_notice_title');
// Because we're expecting a string from get_option(), let's use is_string()
// to check for a string and then ensure the string is longer than `0`. If it isn't
// a string, bail returning the original $title.
if (!is_string($subject) && strlen($subject) == 0) {
return $title;
}
// The reply title token to replace.
$search = '{title}';
// The topic title that will replace the title token.
$replace = strip_tags(bbp_get_topic_title($topic_id));
// Replace the title token if it exists in the custom title.
$title = str_replace($search, $replace, $subject);
return $title;
}
示例7: _bbpress_items
protected function _bbpress_items()
{
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$item[] = '<span typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '" property="v:title" rel="v:url"><span>' . bbp_get_forum_archive_title() . '</span></a></span>';
}
if (bbp_is_forum_archive()) {
$item[] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item[] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item[] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, $this->_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '" property="v:title" rel="v:url"><span>' . bbp_get_topic_title($topic_id) . '</span></a></span>';
} else {
$item[] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item[] = __('Split', DH_DOMAIN);
} elseif (bbp_is_topic_merge()) {
$item[] = __('Merge', DH_DOMAIN);
} elseif (bbp_is_topic_edit()) {
$item[] = __('Edit', DH_DOMAIN);
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, $this->_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item[] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '" property="v:title" rel="v:url"><span>' . bbp_get_reply_title($reply_id) . '</span></a></span>';
$item[] = __('Edit', DH_DOMAIN);
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, $this->_get_parents($forum_parent_id));
}
$item[] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '" property="v:title" rel="v:url" ><span>' . bbp_get_displayed_user_field('display_name') . '</span></a></span>';
$item[] = __('Edit', DH_DOMAIN);
} else {
$item[] = bbp_get_displayed_user_field('display_name');
}
}
return $item;
}
示例8: bbp_title
/**
* Custom page title for bbPress pages
*
* @since bbPress (r2788)
*
* @param string $title Optional. The title (not used).
* @param string $sep Optional, default is '»'. How to separate the
* various items within the page title.
* @param string $seplocation Optional. Direction to display title, 'right'.
* @uses bbp_is_single_user() To check if it's a user profile page
* @uses bbp_is_single_user_edit() To check if it's a user profile edit page
* @uses bbp_is_user_home() To check if the profile page is of the current user
* @uses get_query_var() To get the user id
* @uses get_userdata() To get the user data
* @uses bbp_is_single_forum() To check if it's a forum
* @uses bbp_get_forum_title() To get the forum title
* @uses bbp_is_single_topic() To check if it's a topic
* @uses bbp_get_topic_title() To get the topic title
* @uses bbp_is_single_reply() To check if it's a reply
* @uses bbp_get_reply_title() To get the reply title
* @uses is_tax() To check if it's the tag page
* @uses get_queried_object() To get the queried object
* @uses bbp_is_single_view() To check if it's a view
* @uses bbp_get_view_title() To get the view title
* @uses apply_filters() Calls 'bbp_raw_title' with the title
* @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title,
* separator and separator location
* @return string The tite
*/
function bbp_title($title = '', $sep = '»', $seplocation = '')
{
// Title array
$new_title = array();
/** Archives **************************************************************/
// Forum Archive
if (bbp_is_forum_archive()) {
$new_title['text'] = bbp_get_forum_archive_title();
// Topic Archive
} elseif (bbp_is_topic_archive()) {
$new_title['text'] = bbp_get_topic_archive_title();
/** Edit ******************************************************************/
// Forum edit page
} elseif (bbp_is_forum_edit()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum Edit: %s', 'bbpress');
// Topic edit page
} elseif (bbp_is_topic_edit()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic Edit: %s', 'bbpress');
// Reply edit page
} elseif (bbp_is_reply_edit()) {
$new_title['text'] = bbp_get_reply_title();
$new_title['format'] = esc_attr__('Reply Edit: %s', 'bbpress');
// Topic tag edit page
} elseif (bbp_is_topic_tag_edit()) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag Edit: %s', 'bbpress');
/** Singles ***************************************************************/
// Forum page
} elseif (bbp_is_single_forum()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum: %s', 'bbpress');
// Topic page
} elseif (bbp_is_single_topic()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic: %s', 'bbpress');
// Replies
} elseif (bbp_is_single_reply()) {
$new_title['text'] = bbp_get_reply_title();
// Topic tag page
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag')) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag: %s', 'bbpress');
/** Users *****************************************************************/
// Profile page
} elseif (bbp_is_single_user()) {
// User is viewing their own profile
if (bbp_is_user_home()) {
$new_title['text'] = esc_attr_x('Your', 'User viewing his/her own profile', 'bbpress');
// User is viewing someone else's profile (so use their display name)
} else {
$new_title['text'] = sprintf(esc_attr_x("%s's", 'User viewing another users profile', 'bbpress'), get_userdata(bbp_get_user_id())->display_name);
}
// User topics created
if (bbp_is_single_user_topics()) {
$new_title['format'] = esc_attr__("%s Topics", 'bbpress');
// User rueplies created
} elseif (bbp_is_single_user_replies()) {
$new_title['format'] = esc_attr__("%s Replies", 'bbpress');
// User favorites
} elseif (bbp_is_favorites()) {
$new_title['format'] = esc_attr__("%s Favorites", 'bbpress');
// User subscriptions
} elseif (bbp_is_subscriptions()) {
$new_title['format'] = esc_attr__("%s Subscriptions", 'bbpress');
// User "home"
} else {
$new_title['format'] = esc_attr__("%s Profile", 'bbpress');
}
// Profile edit page
//.........这里部分代码省略.........
示例9: cupid_breadcrumb_get_bbpress_items
function cupid_breadcrumb_get_bbpress_items()
{
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a></li>';
}
if (bbp_is_forum_archive()) {
$item['last'] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item['last'] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item['last'] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a></li>';
} else {
$item['last'] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item['last'] = __('Split', 'cupid');
} elseif (bbp_is_topic_merge()) {
$item['last'] = __('Merge', 'cupid');
} elseif (bbp_is_topic_edit()) {
$item['last'] = __('Edit', 'cupid');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item['last'] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a></li>';
$item['last'] = __('Edit', 'cupid');
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, cupid_breadcrumb_get_parents($forum_parent_id));
}
$item['last'] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a></li>';
$item['last'] = __('Edit', 'cupid');
} else {
$item['last'] = bbp_get_displayed_user_field('display_name');
}
}
return apply_filters('cupid_breadcrumb_get_bbpress_items', $item);
}
示例10: bbp_notify_forum_subscribers
/**
* Sends notification emails for new topics to subscribed forums
*
* Gets new post's ID and check if there are subscribed users to that forum, and
* if there are, send notifications
*
* Note: in bbPress 2.6, we've moved away from 1 email per subscriber to 1 email
* with everyone BCC'd. This may have negative repercussions for email services
* that limit the number of addresses in a BCC field (often to around 500.) In
* those cases, we recommend unhooking this function and creating your own
* custom emailer script.
*
* @since 2.5.0 bbPress (r5156)
*
* @param int $topic_id ID of the newly made reply
* @param int $forum_id ID of the forum for the topic
* @param mixed $anonymous_data Array of anonymous user data
* @param int $topic_author ID of the topic author ID
*
* @uses bbp_is_subscriptions_active() To check if the subscriptions are active
* @uses bbp_get_topic_id() To validate the topic ID
* @uses bbp_get_forum_id() To validate the forum ID
* @uses bbp_is_topic_published() To make sure the topic is published
* @uses bbp_get_forum_subscribers() To get the forum subscribers
* @uses bbp_get_topic_author_display_name() To get the topic author's display name
* @uses do_action() Calls 'bbp_pre_notify_forum_subscribers' with the topic id,
* forum id and user id
* @uses apply_filters() Calls 'bbp_forum_subscription_mail_message' with the
* message, topic id, forum id and user id
* @uses apply_filters() Calls 'bbp_forum_subscription_mail_title' with the
* topic title, topic id, forum id and user id
* @uses apply_filters() Calls 'bbp_forum_subscription_mail_headers'
* @uses get_userdata() To get the user data
* @uses wp_mail() To send the mail
* @uses do_action() Calls 'bbp_post_notify_forum_subscribers' with the topic,
* id, forum id and user id
* @return bool True on success, false on failure
*/
function bbp_notify_forum_subscribers($topic_id = 0, $forum_id = 0, $anonymous_data = false, $topic_author = 0)
{
// Bail if subscriptions are turned off
if (!bbp_is_subscriptions_active()) {
return false;
}
/** Validation ************************************************************/
$topic_id = bbp_get_topic_id($topic_id);
$forum_id = bbp_get_forum_id($forum_id);
/**
* Necessary for backwards compatibility
*
* @see https://bbpress.trac.wordpress.org/ticket/2620
*/
$user_id = 0;
/** Topic *****************************************************************/
// Bail if topic is not published
if (!bbp_is_topic_published($topic_id)) {
return false;
}
// Poster name
$topic_author_name = bbp_get_topic_author_display_name($topic_id);
/** Mail ******************************************************************/
// Remove filters from reply content and topic title to prevent content
// from being encoded with HTML entities, wrapped in paragraph tags, etc...
remove_all_filters('bbp_get_topic_content');
remove_all_filters('bbp_get_topic_title');
// Strip tags from text and setup mail data
$topic_title = strip_tags(bbp_get_topic_title($topic_id));
$topic_content = strip_tags(bbp_get_topic_content($topic_id));
$topic_url = get_permalink($topic_id);
$blog_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
// For plugins to filter messages per reply/topic/user
$message = sprintf(__('%1$s wrote:
%2$s
Topic Link: %3$s
-----------
You are receiving this email because you subscribed to a forum.
Login and visit the topic to unsubscribe from these emails.', 'bbpress'), $topic_author_name, $topic_content, $topic_url);
$message = apply_filters('bbp_forum_subscription_mail_message', $message, $topic_id, $forum_id, $user_id);
if (empty($message)) {
return;
}
// For plugins to filter titles per reply/topic/user
$subject = apply_filters('bbp_forum_subscription_mail_title', '[' . $blog_name . '] ' . $topic_title, $topic_id, $forum_id, $user_id);
if (empty($subject)) {
return;
}
/** User ******************************************************************/
// Get the noreply@ address
$no_reply = bbp_get_do_not_reply_address();
// Setup "From" email address
$from_email = apply_filters('bbp_subscription_from_email', $no_reply);
// Setup the From header
$headers = array('From: ' . get_bloginfo('name') . ' <' . $from_email . '>');
// Get topic subscribers and bail if empty
$user_ids = bbp_get_forum_subscribers($forum_id, true);
//.........这里部分代码省略.........
示例11: bbp_get_forum_last_topic_title
/**
* Return the title of the last topic inside a forum
*
* @since bbPress (r2625)
*
* @param int $forum_id Optional. Forum id
* @uses bbp_get_forum_id() To get the forum id
* @uses bbp_get_forum_last_topic_id() To get the forum's last topic id
* @uses bbp_get_topic_title() To get the topic's title
* @uses apply_filters() Calls 'bbp_get_forum_last_topic_title' with the
* topic title and forum id
* @return string Forum's last topic's title
*/
function bbp_get_forum_last_topic_title($forum_id = 0)
{
$forum_id = bbp_get_forum_id($forum_id);
return apply_filters('bbp_get_forum_last_topic_title', bbp_get_topic_title(bbp_get_forum_last_topic_id($forum_id)), $forum_id);
}
示例12: mk_theme_breadcrumbs
//.........这里部分代码省略.........
foreach ($breadcrumbs as $crumb) {
echo $crumb . '' . $delimiter;
}
echo get_the_title();
} elseif (is_attachment()) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID);
$cat = $cat[0];
/* admin@innodron.com patch:
Fix for Catchable fatal error: Object of class WP_Error could not be converted to string
ref: https://wordpress.org/support/topic/catchable-fatal-error-object-of-class-wp_error-could-not-be-converted-to-string-11
*/
echo is_wp_error($cat_parents = get_category_parents($cat, TRUE, '' . $delimiter . '')) ? '' : $cat_parents;
/* end admin@innodron.com patch */
echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a>' . $delimiter;
echo get_the_title();
} elseif (is_search()) {
echo __('Search results for “', 'mk_framework') . get_search_query() . '”';
} elseif (is_tag()) {
echo __('Tag “', 'mk_framework') . single_tag_title('', false) . '”';
} elseif (is_author()) {
$userdata = get_userdata(get_the_author_meta('ID'));
echo __('Author:', 'mk_framework') . ' ' . $userdata->display_name;
} elseif (is_day()) {
echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter;
echo '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a>' . $delimiter;
echo get_the_time('d');
} elseif (is_month()) {
echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter;
echo get_the_time('F');
} elseif (is_year()) {
echo get_the_time('Y');
}
}
}
if (get_query_var('paged')) {
echo ' (' . __('Page', 'mk_framework') . ' ' . get_query_var('paged') . ')';
}
if (is_tax()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if (function_exists('is_woocommerce') && is_woocommerce() && is_archive()) {
echo $delimiter;
}
echo '<span>' . $term->name . '</span>';
}
if (function_exists('is_bbpress') && is_bbpress()) {
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$item[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
}
if (bbp_is_forum_archive()) {
$item[] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item[] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item[] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, mk_breadcrumbs_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
} else {
$item[] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item[] = __('Split', 'mk_framework');
} elseif (bbp_is_topic_merge()) {
$item[] = __('Merge', 'mk_framework');
} elseif (bbp_is_topic_edit()) {
$item[] = __('Edit', 'mk_framework');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, mk_breadcrumbs_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item[] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
$item[] = __('Edit', 'mk_framework');
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, mk_breadcrumbs_get_parents($forum_parent_id));
}
$item[] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
$item[] = __('Edit', 'mk_framework');
} else {
$item[] = bbp_get_displayed_user_field('display_name');
}
}
echo implode($delimiter, $item);
}
echo "</div></div>";
}
示例13: bbp_get_forum_last_topic_title
/**
* Return the title of the last topic inside a forum
*
* @since bbPress (r2625)
*
* @param int $forum_id Optional. Forum id
* @uses bbp_get_forum_id() To get the forum id
* @uses bbp_get_forum_last_topic_id() To get the forum's last topic id
* @uses bbp_get_topic_title() To get the topic's title
* @uses apply_filters() Calls 'bbp_get_forum_last_topic_title' with the
* topic title and forum id
* @return string Forum's last topic's title
*/
function bbp_get_forum_last_topic_title($forum_id = 0)
{
$forum_id = bbp_get_forum_id($forum_id);
$topic_id = bbp_get_forum_last_topic_id($forum_id);
$title = !empty($topic_id) ? bbp_get_topic_title($topic_id) : '';
return apply_filters('bbp_get_forum_last_topic_title', $title, $forum_id);
}
示例14: breadcrumbs_plus_get_bbpress_items
/**
* Gets the items for the breadcrumb item if bbPress is installed.
*
* @since 0.4
*
* @param array $args Mixed arguments for the menu.
* @return array List of items to be shown in the item.
*/
function breadcrumbs_plus_get_bbpress_items($args = array())
{
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
if (function_exists('bp_is_active')) {
global $bp;
// we're outside the loop!
// Assign some variables here
$page1 = isset($bp->members->root_slug) ? $bp->members->root_slug : '';
// slug for the Members page. The BuddyPress default is 'members'.
$page2 = isset($bp->groups->root_slug) ? $bp->groups->root_slug : '';
// slug for the Groups page. The BuddyPress default is 'groups'.
$page3 = isset($bp->activity->root_slug) ? $bp->activity->root_slug : '';
// slug for the Activity page. The BuddyPress default is 'activity'.
$page4 = isset($bp->forums->root_slug) ? $bp->forums->root_slug : '';
// slug for the Forums page. The BuddyPress default is 'forums'.
$page5 = isset($bp->achievements->root_slug) ? $bp->achievements->root_slug : '';
// slug for the Achievements page. The BuddyPress default is 'achievements'.
if (!bp_is_blog_page() && (is_page() || is_page($page1) || is_page($page2) || is_page($page3) || is_page($page4) || is_page($page5)) && !bp_is_user() && !bp_is_single_item() && !bp_is_register_page()) {
$item[] = '';
}
if (bp_is_user() && !bp_is_register_page()) {
$item[] = '';
}
} else {
//$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link( bbp_get_forum_post_type() ) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>';
}
}
if (bbp_is_forum_archive()) {
$item[] = bbp_get_forum_archive_title();
} else {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>';
}
if (bbp_is_topic_archive()) {
$item[] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item[] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '" rel="v:url" property="v:title">' . bbp_get_topic_title($topic_id) . '</a></div>';
} else {
$item[] = '';
}
if (bbp_is_topic_split()) {
$item[] = __('Split', 'framework');
} elseif (bbp_is_topic_merge()) {
$item[] = __('Merge', 'framework');
} elseif (bbp_is_topic_edit()) {
$item[] = __('Edit', 'framework');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item[] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '" rel="v:url" property="v:title">' . bbp_get_reply_title($reply_id) . '</a></div>';
$item[] = __('Edit', 'framework');
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, breadcrumbs_plus_get_parents($forum_parent_id));
}
$item[] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '" rel="v:url" property="v:title">' . bbp_get_displayed_user_field('display_name') . '</a></div>';
$item[] = __('Edit', 'framework');
} else {
$item[] = bbp_get_displayed_user_field('display_name');
}
}
return apply_filters('breadcrumbs_plus_get_bbpress_items', $item, $args);
}
示例15: elseif
?>
</form>
</div>
<?php
} elseif (bbp_is_topic_closed()) {
?>
<div id="no-reply-<?php
bbp_topic_id();
?>
" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php
printf(esc_html__('The topic ‘%s’ is closed to new replies.', 'monsoon'), bbp_get_topic_title());
?>
</p>
</div>
</div>
<?php
} elseif (bbp_is_forum_closed(bbp_get_topic_forum_id())) {
?>
<div id="no-reply-<?php
bbp_topic_id();
?>
" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php