本文整理汇总了PHP中bbp_is_single_reply函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_single_reply函数的具体用法?PHP bbp_is_single_reply怎么用?PHP bbp_is_single_reply使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_is_single_reply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_template_include_theme_supports
/**
* Possibly intercept the template being loaded
*
* Listens to the 'template_include' filter and waits for any bbPress specific
* template condition to be met. If one is met and the template file exists,
* it will be used; otherwise
*
* Note that the _edit() checks are ahead of their counterparts, to prevent them
* from being stomped on accident.
*
* @since bbPress (r3032)
*
* @param string $template
*
* @uses bbp_is_single_user() To check if page is single user
* @uses bbp_get_single_user_template() To get user template
* @uses bbp_is_single_user_edit() To check if page is single user edit
* @uses bbp_get_single_user_edit_template() To get user edit template
* @uses bbp_is_single_view() To check if page is single view
* @uses bbp_get_single_view_template() To get view template
* @uses bbp_is_search() To check if page is search
* @uses bbp_get_search_template() To get search template
* @uses bbp_is_forum_edit() To check if page is forum edit
* @uses bbp_get_forum_edit_template() To get forum edit template
* @uses bbp_is_topic_merge() To check if page is topic merge
* @uses bbp_get_topic_merge_template() To get topic merge template
* @uses bbp_is_topic_split() To check if page is topic split
* @uses bbp_get_topic_split_template() To get topic split template
* @uses bbp_is_topic_edit() To check if page is topic edit
* @uses bbp_get_topic_edit_template() To get topic edit template
* @uses bbp_is_reply_move() To check if page is reply move
* @uses bbp_get_reply_move_template() To get reply move template
* @uses bbp_is_reply_edit() To check if page is reply edit
* @uses bbp_get_reply_edit_template() To get reply edit template
* @uses bbp_set_theme_compat_template() To set the global theme compat template
*
* @return string The path to the template file that is being used
*/
function bbp_template_include_theme_supports($template = '')
{
// Editing a user
if (bbp_is_single_user_edit() && ($new_template = bbp_get_single_user_edit_template())) {
// User favorites
} elseif (bbp_is_favorites() && ($new_template = bbp_get_favorites_template())) {
// User favorites
} elseif (bbp_is_subscriptions() && ($new_template = bbp_get_subscriptions_template())) {
// Viewing a user
} elseif (bbp_is_single_user() && ($new_template = bbp_get_single_user_template())) {
// Single View
} elseif (bbp_is_single_view() && ($new_template = bbp_get_single_view_template())) {
// Search
} elseif (bbp_is_search() && ($new_template = bbp_get_search_template())) {
// Forum edit
} elseif (bbp_is_forum_edit() && ($new_template = bbp_get_forum_edit_template())) {
// Single Forum
} elseif (bbp_is_single_forum() && ($new_template = bbp_get_single_forum_template())) {
// Forum Archive
} elseif (bbp_is_forum_archive() && ($new_template = bbp_get_forum_archive_template())) {
// Topic merge
} elseif (bbp_is_topic_merge() && ($new_template = bbp_get_topic_merge_template())) {
// Topic split
} elseif (bbp_is_topic_split() && ($new_template = bbp_get_topic_split_template())) {
// Topic edit
} elseif (bbp_is_topic_edit() && ($new_template = bbp_get_topic_edit_template())) {
// Single Topic
} elseif (bbp_is_single_topic() && ($new_template = bbp_get_single_topic_template())) {
// Topic Archive
} elseif (bbp_is_topic_archive() && ($new_template = bbp_get_topic_archive_template())) {
// Reply move
} elseif (bbp_is_reply_move() && ($new_template = bbp_get_reply_move_template())) {
// Editing a reply
} elseif (bbp_is_reply_edit() && ($new_template = bbp_get_reply_edit_template())) {
// Single Reply
} elseif (bbp_is_single_reply() && ($new_template = bbp_get_single_reply_template())) {
// Editing a topic tag
} elseif (bbp_is_topic_tag_edit() && ($new_template = bbp_get_topic_tag_edit_template())) {
// Viewing a topic tag
} elseif (bbp_is_topic_tag() && ($new_template = bbp_get_topic_tag_template())) {
}
// A bbPress template file was located, so override the WordPress template
// and use it to switch off bbPress's theme compatibility.
if (!empty($new_template)) {
$template = bbp_set_template_included($new_template);
}
return apply_filters('bbp_template_include_theme_supports', $template);
}
示例2: bbp_template_include_theme_supports
/**
* Possibly intercept the template being loaded
*
* Listens to the 'template_include' filter and waits for any bbPress specific
* template condition to be met. If one is met and the template file exists,
* it will be used; otherwise
*
* Note that the _edit() checks are ahead of their counterparts, to prevent them
* from being stomped on accident.
*
* @since bbPress (r3032)
*
* @param string $template
*
* @uses bbp_is_single_user() To check if page is single user
* @uses bbp_get_single_user_template() To get user template
* @uses bbp_is_single_user_edit() To check if page is single user edit
* @uses bbp_get_single_user_edit_template() To get user edit template
* @uses bbp_is_single_view() To check if page is single view
* @uses bbp_get_single_view_template() To get view template
* @uses bbp_is_forum_edit() To check if page is forum edit
* @uses bbp_get_forum_edit_template() To get forum edit template
* @uses bbp_is_topic_merge() To check if page is topic merge
* @uses bbp_get_topic_merge_template() To get topic merge template
* @uses bbp_is_topic_split() To check if page is topic split
* @uses bbp_get_topic_split_template() To get topic split template
* @uses bbp_is_topic_edit() To check if page is topic edit
* @uses bbp_get_topic_edit_template() To get topic edit template
* @uses bbp_is_reply_edit() To check if page is reply edit
* @uses bbp_get_reply_edit_template() To get reply edit template
* @uses bbp_set_theme_compat_template() To set the global theme compat template
*
* @return string The path to the template file that is being used
*/
function bbp_template_include_theme_supports($template = '')
{
// Editing a user
if (bbp_is_single_user_edit() && ($new_template = bbp_get_single_user_edit_template())) {
// User favorites
} elseif (bbp_is_favorites() && ($new_template = bbp_get_favorites_template())) {
// User favorites
} elseif (bbp_is_subscriptions() && ($new_template = bbp_get_subscriptions_template())) {
// Viewing a user
} elseif (bbp_is_single_user() && ($new_template = bbp_get_single_user_template())) {
// Single View
} elseif (bbp_is_single_view() && ($new_template = bbp_get_single_view_template())) {
// Forum edit
} elseif (bbp_is_forum_edit() && ($new_template = bbp_get_forum_edit_template())) {
// Single Forum
} elseif (bbp_is_single_forum() && ($new_template = bbp_get_single_forum_template())) {
// Forum Archive
} elseif (bbp_is_forum_archive() && ($new_template = bbp_get_forum_archive_template())) {
// Topic merge
} elseif (bbp_is_topic_merge() && ($new_template = bbp_get_topic_merge_template())) {
// Topic split
} elseif (bbp_is_topic_split() && ($new_template = bbp_get_topic_split_template())) {
// Topic edit
} elseif (bbp_is_topic_edit() && ($new_template = bbp_get_topic_edit_template())) {
// Single Topic
} elseif (bbp_is_single_topic() && ($new_template = bbp_get_single_topic_template())) {
// Topic Archive
} elseif (bbp_is_topic_archive() && ($new_template = bbp_get_topic_archive_template())) {
// Editing a reply
} elseif (bbp_is_reply_edit() && ($new_template = bbp_get_reply_edit_template())) {
// Single Reply
} elseif (bbp_is_single_reply() && ($new_template = bbp_get_single_reply_template())) {
// Editing a topic tag
} elseif (bbp_is_topic_tag_edit() && ($new_template = bbp_get_topic_tag_edit_template())) {
// Viewing a topic tag
} elseif (bbp_is_topic_tag() && ($new_template = bbp_get_topic_tag_template())) {
}
// bbPress template file exists
if (!empty($new_template)) {
// Override the WordPress template with a bbPress one
$template = $new_template;
// @see: bbp_template_include_theme_compat()
bbpress()->theme_compat->bbpress_template = true;
}
return apply_filters('bbp_template_include_theme_supports', $template);
}
示例3: nav_menu_css_class
static function nav_menu_css_class($classes, $item, $args, $depth)
{
if ($item->object == bbp_get_forum_post_type() && is_bbpress()) {
if (bbp_is_topic_edit() || bbp_is_single_topic()) {
$forum_id = bbp_get_topic_forum_id();
if ($forum_id == $item->object_id) {
$classes[] = 'current-menu-parent';
$classes[] = 'current-' . bbp_get_topic_post_type() . '-parent';
} elseif ($ancestors = self::forum_ancestors($forum_id, array())) {
if (in_array($item->object_id, $ancestors)) {
$classes[] = 'current-menu-ancestor';
$classes[] = 'current-' . bbp_get_topic_post_type() . '-ancestor';
}
}
} elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
$forum_id = bbp_get_reply_forum_id();
}
}
return $classes;
}
示例4: 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>";
}
示例5: wm_bbp_large_topic
function wm_bbp_large_topic()
{
global $paged;
//Requirements check
if (!(bbp_is_single_topic() || bbp_is_single_reply())) {
return;
}
//Helper variables
$output = array();
$post_id = bbp_is_single_reply() ? bbp_get_reply_topic_id() : get_the_id();
//Preparing output
$output[10] = '<div class="bbp-large-topic">';
$output[20] = '<div class="wrap-inner">';
$output[30] = '<div class="content-area site-content pane twelve">';
$output[100] = '<div ' . bbp_get_reply_class() . wm_schema_org('article') . '>';
//Author
$output[110] = '<div class="bbp-reply-author">';
$output[120] = bbp_get_reply_author_link(array('post_id' => $post_id, 'sep' => '<br />', 'show_role' => true));
$output[130] = '</div>';
// /.bbp-reply-author
//Heading and content
$output[200] = '<div class="bbp-reply-content">';
$output[210] = '<h1 class="bbp-topic-title">';
if (1 < $paged) {
$output[210] .= '<a href="' . get_permalink($post_id) . '">';
}
$output[210] .= bbp_get_topic_title($post_id);
if (1 < $paged) {
$output[210] .= '</a> ' . wm_paginated_suffix('small');
}
$output[210] .= '</h1>';
$output[220] = bbp_get_topic_tag_list($post_id);
if (!post_password_required($post_id)) {
$output[230] = '<div class="bbp-content-container">';
setup_postdata(get_post($post_id));
$output[240] = apply_filters('wmhook_content_filters', bbp_get_topic_content($post_id), $post_id);
wp_reset_postdata();
$output[250] = '</div>';
// /.bbp-content-container
}
$output[260] = '</div>';
// /.bbp-reply-content
//Meta
$output[300] = '<div class="bbp-meta">';
$output[310] = '<span class="bbp-reply-post-date">' . bbp_get_reply_post_date($post_id) . '</span>';
if (bbp_is_single_user_replies()) {
$output[320] = '<span class="bbp-header">';
$output[330] = __('in reply to: ', 'mustang');
$output[340] = '<a class="bbp-topic-permalink" href="' . bbp_get_topic_permalink(bbp_get_reply_topic_id($post_id)) . '">';
$output[350] = bbp_get_topic_title(bbp_get_reply_topic_id($post_id));
$output[360] = '</a>';
// /.bbp-topic-permalink
$output[370] = '</span>';
// /.bbp-header
}
$output[380] = bbp_get_reply_admin_links(array('id' => $post_id));
$output[390] = '</div>';
// /.bbp-meta
$output[500] = '</div>';
// /.bbp_get_reply_class()
$output[600] = '</div>';
// /.content-area
$output[610] = '</div>';
// /.wrap-inner
$output[620] = '</div>';
// /.bbp-large-topic
//Output
$output = apply_filters('wmhook_wm_bbp_large_topic_output', $output, $post_id);
echo implode('', $output);
}
示例6: post_stylesheets_stylesheet_uri
/**
* Checks if a post (or any post type) has the given meta key of 'Stylesheet' when on the singular view of
* the post on the front of the site. If found, the function checks within the '/css' folder of the stylesheet
* directory (child theme) and the template directory (parent theme). If the file exists, it is used rather
* than the typical style.css file.
*
* @since 0.1.0
* @todo Use features from Ticket #18302 when available. http://core.trac.wordpress.org/ticket/18302
* @access public
* @param string $stylesheet_uri The URI of the active theme's stylesheet.
* @param string $stylesheet_dir_uri The directory URI of the active theme's stylesheet.
* @return string $stylesheet_uri
*/
function post_stylesheets_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri)
{
/* Check if viewing a singular post. */
if (is_singular()) {
/* If viewing a bbPress topic, use its forum object. */
if (function_exists('bbp_is_single_topic') && bbp_is_single_topic()) {
$post = get_post(bbp_get_topic_forum_id(get_queried_object_id()));
} elseif (function_exists('bbp_is_single_reply') && bbp_is_single_reply()) {
$post = get_post(bbp_get_reply_forum_id(get_queried_object_id()));
} else {
$post = get_queried_object();
}
/* Check if the post type supports 'post-stylesheets' before proceeding. */
if (post_type_supports($post->post_type, 'post-stylesheets')) {
/* Check if the user has set a value for the post stylesheet. */
$stylesheet = get_post_stylesheet($post->ID);
/* If a meta value was given and the file exists, set $stylesheet_uri to the new file. */
if (!empty($stylesheet)) {
/* If the stylesheet is found in the child theme, use it. */
if (file_exists(trailingslashit(get_stylesheet_directory()) . $stylesheet)) {
$stylesheet_uri = trailingslashit($stylesheet_dir_uri) . $stylesheet;
} elseif (file_exists(trailingslashit(get_template_directory()) . $stylesheet)) {
$stylesheet_uri = trailingslashit(get_template_directory_uri()) . $stylesheet;
} else {
/* If the stylesheet is found in the child theme '/css' folder, use it. */
if (file_exists(trailingslashit(get_stylesheet_directory()) . "css/{$stylesheet}")) {
$stylesheet_uri = trailingslashit($stylesheet_dir_uri) . "css/{$stylesheet}";
/* Set the post stylesheet to the correct directory. */
set_post_stylesheet($post->ID, str_replace(get_stylesheet_directory_uri(), 'css/', $stylesheet_uri));
} elseif (file_exists(trailingslashit(get_template_directory()) . "css/{$stylesheet}")) {
$stylesheet_uri = trailingslashit(get_template_directory_uri()) . "css/{$stylesheet}";
/* Set the post stylesheet to the correct directory. */
set_post_stylesheet($post->ID, str_replace(get_template_directory_uri(), 'css/', $stylesheet_uri));
}
}
}
}
}
/* Return the stylesheet URI. */
return $stylesheet_uri;
}
示例7: bbp_get_form_topic_tags
/**
* Return value of topic tags field
*
* @since 2.0.0 bbPress (r2976)
*
* @uses bbp_is_topic_edit() To check if it's the topic edit page
* @uses apply_filters() Calls 'bbp_get_form_topic_tags' with the tags
* @return string Value of topic tags field
*/
function bbp_get_form_topic_tags()
{
// Default return value
$topic_tags = '';
// Get _POST data
if ((bbp_is_topic_form_post_request() || bbp_is_reply_form_post_request()) && isset($_POST['bbp_topic_tags'])) {
$topic_tags = wp_unslash($_POST['bbp_topic_tags']);
// Get edit data
} elseif (bbp_is_single_topic() || bbp_is_single_reply() || bbp_is_topic_edit() || bbp_is_reply_edit()) {
// Determine the topic id based on the post type
switch (get_post_type()) {
// Post is a topic
case bbp_get_topic_post_type():
$topic_id = bbp_get_topic_id(get_the_ID());
break;
// Post is a reply
// Post is a reply
case bbp_get_reply_post_type():
$topic_id = bbp_get_reply_topic_id(get_the_ID());
break;
}
// Topic exists
if (!empty($topic_id)) {
// Topic is spammed so display pre-spam terms
if (bbp_is_topic_spam($topic_id)) {
// Get pre-spam terms
$spam_terms = get_post_meta($topic_id, '_bbp_spam_topic_tags', true);
$topic_tags = !empty($spam_terms) ? implode(', ', $spam_terms) : '';
// Topic is not spam so get real terms
} else {
$topic_tags = bbp_get_topic_tag_names($topic_id);
}
}
}
return apply_filters('bbp_get_form_topic_tags', $topic_tags);
}
示例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 = '')
{
// Store original title to compare
$_title = $title;
/** Archives **************************************************************/
// Forum Archive
if (bbp_is_forum_archive()) {
$title = bbp_get_forum_archive_title();
// Topic Archive
} elseif (bbp_is_topic_archive()) {
$title = bbp_get_topic_archive_title();
/** Singles ***************************************************************/
// Forum page
} elseif (bbp_is_single_forum()) {
$title = sprintf(__('Forum: %s', 'bbpress'), bbp_get_forum_title());
// Topic page
} elseif (bbp_is_single_topic()) {
$title = sprintf(__('Topic: %s', 'bbpress'), bbp_get_topic_title());
// Replies
} elseif (bbp_is_single_reply()) {
$title = bbp_get_reply_title();
// Topic tag page (or edit)
} elseif (bbp_is_topic_tag() || bbp_is_topic_tag_edit() || get_query_var('bbp_topic_tag')) {
$term = get_queried_object();
$title = sprintf(__('Topic Tag: %s', 'bbpress'), $term->name);
/** Users *****************************************************************/
// Profile page
} elseif (bbp_is_single_user()) {
// Current users profile
if (bbp_is_user_home()) {
$title = __('Your Profile', 'bbpress');
// Other users profile
} else {
$userdata = get_userdata(bbp_get_user_id());
$title = sprintf(__('%s\'s Profile', 'bbpress'), $userdata->display_name);
}
// Profile edit page
} elseif (bbp_is_single_user_edit()) {
// Current users profile
if (bbp_is_user_home_edit()) {
$title = __('Edit Your Profile', 'bbpress');
// Other users profile
} else {
$userdata = get_userdata(bbp_get_user_id());
$title = sprintf(__('Edit %s\'s Profile', 'bbpress'), $userdata->display_name);
}
/** Views *****************************************************************/
// Views
} elseif (bbp_is_single_view()) {
$title = sprintf(__('View: %s', 'bbpress'), bbp_get_view_title());
}
// Filter the raw title
$title = apply_filters('bbp_raw_title', $title, $sep, $seplocation);
// Compare new title with original title
if ($title == $_title) {
return $title;
}
// Temporary separator, for accurate flipping, if necessary
$t_sep = '%WP_TITILE_SEP%';
$prefix = '';
if (!empty($title)) {
$prefix = " {$sep} ";
}
// sep on right, so reverse the order
if ('right' == $seplocation) {
$title_array = explode($t_sep, $title);
$title_array = array_reverse($title_array);
$title = implode(" {$sep} ", $title_array) . $prefix;
// sep on left, do not reverse
} else {
$title_array = explode($t_sep, $title);
//.........这里部分代码省略.........
示例9: bbp_redirect_canonical
/**
* Remove the canonical redirect to allow pretty pagination
*
* @since bbPress (r2628)
* @param string $redirect_url Redirect url
* @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
* @uses bbp_get_paged() To get the current page number
* @uses bbp_is_single_topic() To check if it's a topic page
* @uses bbp_is_single_forum() To check if it's a forum page
* @return bool|string False if it's a topic/forum and their first page,
* otherwise the redirect url
*/
function bbp_redirect_canonical($redirect_url)
{
global $wp_rewrite;
// Canonical is for the beautiful
if ($wp_rewrite->using_permalinks()) {
// If viewing beyond page 1 of several
if (1 < bbp_get_paged()) {
// Only on single topics...
if (bbp_is_single_topic()) {
$redirect_url = false;
// ...and single forums...
} elseif (bbp_is_single_forum()) {
$redirect_url = false;
// ...and single replies...
} elseif (bbp_is_single_reply()) {
$redirect_url = false;
// ...and any single anything else...
//
// @todo - Find a more accurate way to disable paged canonicals for
// paged shortcode usage within other posts.
} elseif (is_page() || is_singular()) {
$redirect_url = false;
}
// If editing a topic
} elseif (bbp_is_topic_edit()) {
$redirect_url = false;
// If editing a reply
} elseif (bbp_is_reply_edit()) {
$redirect_url = false;
}
}
return $redirect_url;
}
示例10: x_bbpress_filter_breadcrumbs
function x_bbpress_filter_breadcrumbs($r)
{
if (bbp_is_search()) {
$current_text = bbp_get_search_title();
} elseif (bbp_is_forum_archive()) {
$current_text = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$current_text = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$current_text = bbp_get_view_title();
} elseif (bbp_is_single_forum()) {
$current_text = bbp_get_forum_title();
} elseif (bbp_is_single_topic()) {
$current_text = bbp_get_topic_title();
} elseif (bbp_is_single_reply()) {
$current_text = bbp_get_reply_title();
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag') && !bbp_is_topic_tag_edit()) {
// Always include the tag name
$tag_data[] = bbp_get_topic_tag_name();
// If capable, include a link to edit the tag
if (current_user_can('manage_topic_tags')) {
$tag_data[] = '<a href="' . esc_url(bbp_get_topic_tag_edit_link()) . '" class="bbp-edit-topic-tag-link">' . esc_html__('(Edit)', 'bbpress') . '</a>';
}
// Implode the results of the tag data
$current_text = sprintf(__('Topic Tag: %s', 'bbpress'), implode(' ', $tag_data));
} elseif (bbp_is_topic_tag_edit()) {
$current_text = __('Edit', 'bbpress');
} else {
$current_text = get_the_title();
}
$r = array('before' => '', 'after' => '', 'sep' => x_get_breadcrumb_delimiter(), 'pad_sep' => 0, 'sep_before' => '', 'sep_after' => '', 'crumb_before' => '', 'crumb_after' => '', 'include_home' => false, 'home_text' => x_get_breadcrumb_home_text(), 'include_root' => true, 'root_text' => bbp_get_forum_archive_title(), 'include_current' => true, 'current_text' => $current_text, 'current_before' => x_get_breadcrumb_current_before(), 'current_after' => x_get_breadcrumb_current_after());
return $r;
}
示例11: get_forum_id
function get_forum_id($forum_id)
{
if (!$forum_id) {
if (bbp_is_topic_edit()) {
$forum_id = bbp_get_topic_forum_id();
} elseif (bbp_is_single_reply() || bbp_is_reply_edit()) {
$forum_id = bbp_get_reply_forum_id();
}
}
return $forum_id;
}
示例12: get_page_header_title
protected function get_page_header_title()
{
global $oxy_theme_options;
if (bbp_is_forum_archive()) {
return $oxy_theme_options['bbpress_header_forums'];
} else {
if (bbp_is_topic_archive()) {
return $oxy_theme_options['bbpress_header_topics'];
} else {
if (bbp_is_single_view()) {
return bbp_get_view_title();
} else {
if (bbp_is_single_forum()) {
return bbp_get_forum_title();
} else {
if (bbp_is_single_topic()) {
return bbp_get_topic_title();
} else {
if (bbp_is_topic_tag()) {
return __('Tag: ', 'omega-td') . bbp_get_topic_tag_name();
} else {
if (bbp_is_single_reply()) {
return bbp_get_reply_title();
} else {
if (bbp_is_topic_tag_edit()) {
return __('Edit', 'omega-td');
} else {
if (bbp_is_search()) {
return bbp_get_search_title();
} else {
if (bbp_is_single_user()) {
return bbp_get_displayed_user_field('display_name');
} else {
return get_the_title();
}
}
}
}
}
}
}
}
}
}
}
示例13: media_view_settings
static function media_view_settings($settings, $post)
{
$forum_id = 0;
if (is_admin()) {
} elseif (bbp_is_single_user_edit() || bbp_is_single_user()) {
} elseif (bbp_is_forum_archive()) {
} elseif (bbp_is_forum_edit()) {
$forum_id = bbp_get_forum_id();
} elseif (bbp_is_single_forum()) {
$forum_id = bbp_get_forum_id();
} elseif (bbp_is_topic_archive()) {
} elseif (bbp_is_topic_edit() || bbp_is_single_topic()) {
$forum_id = bbp_get_forum_id();
} elseif (is_post_type_archive(bbp_get_reply_post_type())) {
} elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
$forum_id = bbp_get_forum_id();
} elseif (bbp_is_single_view()) {
} elseif (bbp_is_search()) {
} elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) {
$forum_id = bbp_get_forum_id();
}
if ($forum_id) {
// @setcookie('_bbp_forum_id', $forum_id, 0, COOKIEPATH, COOKIE_DOMAIN);
if (empty($settings['post'])) {
$settings['post'] = array('id' => $forum_id, 'nonce' => wp_create_nonce('update-post_' . $forum_id));
}
} else {
// @setcookie('_bbp_forum_id', ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
}
return $settings;
}
示例14: breadcrumb_trail_get_bbpress_items
/**
* Gets the items for the breadcrumb trail if bbPress is installed.
*
* @since 0.5.0
* @access public
* @param array $args Mixed arguments for the menu.
* @return array List of items to be shown in the trail.
*/
function breadcrumb_trail_get_bbpress_items($args = array())
{
/* Set up a new trail items array. */
$trail = array();
/* Get the forum post type object. */
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
/* If not viewing the forum root/archive page and a forum archive exists, add it. */
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$trail[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
}
/* If viewing the forum root/archive. */
if (bbp_is_forum_archive()) {
$trail[] = "<span>" . bbp_get_forum_archive_title() . "</span>";
} elseif (bbp_is_topic_archive()) {
$trail[] = "<span>" . bbp_get_topic_archive_title() . "</span>";
} elseif (bbp_is_topic_tag()) {
$trail[] = "<span>" . bbp_get_topic_tag_name() . "</span>";
} elseif (bbp_is_topic_tag_edit()) {
$trail[] = '<a href="' . bbp_get_topic_tag_link() . '">' . bbp_get_topic_tag_name() . '</a>';
$trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>";
} elseif (bbp_is_single_view()) {
$trail[] = '<span>' . bbp_get_view_title() . '</span>';
} elseif (bbp_is_single_topic()) {
/* Get the queried topic. */
$topic_id = get_queried_object_id();
/* Get the parent items for the topic, which would be its forum (and possibly forum grandparents). */
$trail = array_merge($trail, breadcrumb_trail_get_parents(bbp_get_topic_forum_id($topic_id)));
/* If viewing a split, merge, or edit topic page, show the link back to the topic. Else, display topic title. */
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$trail[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
} else {
$trail[] = '<span>' . bbp_get_topic_title($topic_id) . '</span>';
}
/* If viewing a topic split page. */
if (bbp_is_topic_split()) {
$trail[] = "<span>" . __('Split', 'kleo_framework') . "</span>";
} elseif (bbp_is_topic_merge()) {
$trail[] = "<span>" . __('Merge', 'kleo_framework') . "</span>";
} elseif (bbp_is_topic_edit()) {
$trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>";
}
} elseif (bbp_is_single_reply()) {
/* Get the queried reply object ID. */
$reply_id = get_queried_object_id();
/* Get the parent items for the reply, which should be its topic. */
$trail = array_merge($trail, breadcrumb_trail_get_parents(bbp_get_reply_topic_id($reply_id)));
/* If viewing a reply edit page, link back to the reply. Else, display the reply title. */
if (bbp_is_reply_edit()) {
$trail[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
$trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>";
} else {
$trail[] = '<span>' . bbp_get_reply_title($reply_id) . '</span>';
}
} elseif (bbp_is_single_forum()) {
/* Get the queried forum ID and its parent forum ID. */
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
/* If the forum has a parent forum, get its parent(s). */
if (0 !== $forum_parent_id) {
$trail = array_merge($trail, breadcrumb_trail_get_parents($forum_parent_id));
}
/* Add the forum title to the end of the trail. */
$trail[] = '<span>' . bbp_get_forum_title($forum_id) . '</span>';
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$trail[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
$trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>";
} else {
$trail[] = '<span>' . bbp_get_displayed_user_field('display_name') . '</span>';
}
}
/* Return the bbPress breadcrumb trail items. */
return apply_filters('breadcrumb_trail_get_bbpress_items', $trail, $args);
}
示例15: bbp_get_reply_id
/**
* Return the id of the reply in a replies loop
*
* @since bbPress (r2553)
*
* @param $reply_id Optional. Used to check emptiness
* @uses bbPress::reply_query::post::ID To get the reply id
* @uses bbp_is_reply() To check if it's a reply page
* @uses bbp_is_reply_edit() To check if it's a reply edit page
* @uses get_post_field() To get the post's post type
* @uses WP_Query::post::ID To get the reply id
* @uses bbp_get_reply_post_type() To get the reply post type
* @uses apply_filters() Calls 'bbp_get_reply_id' with the reply id and
* supplied reply id
* @return int The reply id
*/
function bbp_get_reply_id($reply_id = 0)
{
global $wp_query;
$bbp = bbpress();
// Easy empty checking
if (!empty($reply_id) && is_numeric($reply_id)) {
$bbp_reply_id = $reply_id;
} elseif (!empty($bbp->reply_query->in_the_loop) && isset($bbp->reply_query->post->ID)) {
$bbp_reply_id = $bbp->reply_query->post->ID;
} elseif ((bbp_is_single_reply() || bbp_is_reply_edit()) && !empty($bbp->current_reply_id)) {
$bbp_reply_id = $bbp->current_reply_id;
} elseif ((bbp_is_single_reply() || bbp_is_reply_edit()) && isset($wp_query->post->ID)) {
$bbp_reply_id = $wp_query->post->ID;
} else {
$bbp_reply_id = 0;
}
return (int) apply_filters('bbp_get_reply_id', (int) $bbp_reply_id, $reply_id);
}