function bpmagic_strip_archive_class_on_forums($classes) { if (bbp_is_forum_archive() || bbp_is_topic_archive()) { //search through the arrayand replace $class_count = count($classes); for ($i = 0; $i < $class_count; $i++) { if ($classes[$i] == 'archive') { unset($classes[$i]); } } } return $classes; }
/** * The main forum loop. * * WordPress makes this easy for us. * * @since bbPress (r2464) * * @param mixed $args All the arguments supported by {@link WP_Query} * @uses WP_Query To make query and get the forums * @uses bbp_get_forum_post_type() To get the forum post type id * @uses bbp_get_forum_id() To get the forum id * @uses get_option() To get the forums per page option * @uses current_user_can() To check if the current user is capable of editing * others' forums * @uses apply_filters() Calls 'bbp_has_forums' with * bbPres::forum_query::have_posts() * and bbPres::forum_query * @return object Multidimensional array of forum information */ function bbp_has_forums($args = '') { $bbp = bbpress(); // Setup possible post__not_in array $post_stati[] = bbp_get_public_status_id(); // Super admin get whitelisted post statuses if (is_super_admin()) { $post_stati = array(bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id()); // Not a super admin, so check caps } else { // Check if user can read private forums if (current_user_can('read_private_forums')) { $post_stati[] = bbp_get_private_status_id(); } // Check if user can read hidden forums if (current_user_can('read_hidden_forums')) { $post_stati[] = bbp_get_hidden_status_id(); } } // The default forum query for most circumstances $defaults = array('post_type' => bbp_get_forum_post_type(), 'post_parent' => bbp_is_forum_archive() ? 0 : bbp_get_forum_id(), 'post_status' => implode(',', $post_stati), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'orderby' => 'menu_order', 'order' => 'ASC'); $bbp_f = bbp_parse_args($args, $defaults, 'has_forums'); // Run the query $bbp->forum_query = new WP_Query($bbp_f); return apply_filters('bbp_has_forums', $bbp->forum_query->have_posts(), $bbp->forum_query); }
/** * Get sidebar settings based on the page type * * @return array */ public function sidebar_options() { if (is_home()) { $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('blog_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('blog_archive_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position')); } elseif (function_exists('is_bbpress') && is_bbpress()) { $sidebars = array('global' => Avada()->settings->get('bbpress_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position')); if (bbp_is_forum_archive() || bbp_is_topic_archive() || bbp_is_user_home() || bbp_is_search()) { $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position')); } } elseif (function_exists('is_buddypress') && is_buddypress()) { $sidebars = array('global' => Avada()->settings->get('bbpress_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position')); } elseif (class_exists('WooCommerce') && (is_product() || is_shop())) { $sidebars = array('global' => Avada()->settings->get('woo_global_sidebar'), 'sidebar_1' => Avada()->settings->get('woo_sidebar'), 'sidebar_2' => Avada()->settings->get('woo_sidebar_2'), 'position' => Avada()->settings->get('woo_sidebar_position')); } elseif (class_exists('WooCommerce') && (is_product_category() || is_product_tag())) { $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('woocommerce_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('woocommerce_archive_sidebar_2'), 'position' => Avada()->settings->get('woo_sidebar_position')); } elseif (is_page()) { $sidebars = array('global' => Avada()->settings->get('pages_global_sidebar'), 'sidebar_1' => Avada()->settings->get('pages_sidebar'), 'sidebar_2' => Avada()->settings->get('pages_sidebar_2'), 'position' => Avada()->settings->get('default_sidebar_pos')); } elseif (is_single()) { $sidebars = array('global' => Avada()->settings->get('posts_global_sidebar'), 'sidebar_1' => Avada()->settings->get('posts_sidebar'), 'sidebar_2' => Avada()->settings->get('posts_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position')); if (is_singular('avada_portfolio')) { $sidebars = array('global' => Avada()->settings->get('portfolio_global_sidebar'), 'sidebar_1' => Avada()->settings->get('portfolio_sidebar'), 'sidebar_2' => Avada()->settings->get('portfolio_sidebar_2'), 'position' => Avada()->settings->get('portfolio_sidebar_position')); } else { if (is_singular('tribe_events') || is_singular('tribe_organizer') || is_singular('tribe_venue')) { $sidebars = array('global' => Avada()->settings->get('ec_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ec_sidebar'), 'sidebar_2' => Avada()->settings->get('ec_sidebar_2'), 'position' => Avada()->settings->get('ec_sidebar_pos')); } } if (is_singular('tribe_organizer') || is_singular('tribe_venue')) { $sidebars['global'] = 1; } } elseif (is_archive()) { $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('blog_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('blog_archive_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position')); if (is_post_type_archive('avada_portfolio') || is_tax('portfolio_category') || is_tax('portfolio_skills') || is_tax('portfolio_tags')) { $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('portfolio_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('portfolio_archive_sidebar_2'), 'position' => Avada()->settings->get('portfolio_sidebar_position')); } } elseif (is_search()) { $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('search_sidebar'), 'sidebar_2' => Avada()->settings->get('search_sidebar_2'), 'position' => Avada()->settings->get('search_sidebar_position')); } else { $sidebars = array('global' => Avada()->settings->get('pages_global_sidebar'), 'sidebar_1' => Avada()->settings->get('pages_sidebar'), 'sidebar_2' => Avada()->settings->get('pages_sidebar_2'), 'position' => Avada()->settings->get('default_sidebar_pos')); } if (class_exists('Tribe__Events__Main') && is_events_archive()) { $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('ec_sidebar'), 'sidebar_2' => Avada()->settings->get('ec_sidebar_2'), 'position' => Avada()->settings->get('ec_sidebar_pos')); } // Remove sidebars from the certain woocommerce pages if (class_exists('WooCommerce')) { if (is_cart() || is_checkout() || is_account_page() || get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id'))) { $sidebars = array(); } } return $sidebars; }
function gpbbp_forum_redirect() { $COUNCIL_FORUM_ROOT_PATH = '/discussions/council/'; if (bbp_is_forum_archive()) { $user_groups = find_all_groups_for_user(get_current_user_id()); // If user belongs to two groups (one is always 'Registered'), then the second must be a Council group if (count($user_groups) == 2) { $group = $user_groups[1]; // Redirect user to council forum (home url + our forum constant + regex-adjusted name of group) $group_path = home_url() . $COUNCIL_FORUM_ROOT_PATH . strtolower(preg_replace('/\\s+Council/', '', $group->name)); wp_redirect($group_path); exit; } } }
/** * 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); }
/** * 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); }
/** * This function filters the list of forums based on the users rank as set by the Mebmers plugin */ function tehnik_bpp_filter_forums_by_permissions($args = '') { $bbp = bbpress(); // Setup possible post__not_in array $post_stati[] = bbp_get_public_status_id(); // Check if user can read private forums if (current_user_can('read_private_forums')) { $post_stati[] = bbp_get_private_status_id(); } // Check if user can read hidden forums if (current_user_can('read_hidden_forums')) { $post_stati[] = bbp_get_hidden_status_id(); } // The default forum query for most circumstances $meta_query = array('post_type' => bbp_get_forum_post_type(), 'post_parent' => bbp_is_forum_archive() ? 0 : bbp_get_forum_id(), 'post_status' => implode(',', $post_stati), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'orderby' => 'menu_order', 'order' => 'ASC'); //Get an array of IDs which the current user has permissions to view $allowed_forums = tehnik_bpp_get_permitted_post_ids(new WP_Query($meta_query)); // The default forum query with allowed forum ids array added $meta_query['post__in'] = $allowed_forums; $bbp_f = bbp_parse_args($args, $meta_query, 'has_forums'); // Run the query $bbp->forum_query = new WP_Query($bbp_f); return apply_filters('bpp_filter_forums_by_permissions', $bbp->forum_query->have_posts(), $bbp->forum_query); }
function wp_sh_check_valid_tag() { global $wp_sh_setting_opt, $post, $wp_query; $highlight = 0; // Search valid tag if (is_home() && $wp_sh_setting_opt['highlight_home'] == 1 || (is_single() || is_page()) && $wp_sh_setting_opt['highlight_posts'] == 1 || is_category() && $wp_sh_setting_opt['highlight_categories'] == 1 || is_archive() && $wp_sh_setting_opt['highlight_archives'] == 1 || is_search() && $wp_sh_setting_opt['highlight_search'] == 1 || !is_home() && !is_single() && !is_page() && !is_category() && !is_archive() && !is_search() && !is_admin() && $wp_sh_setting_opt['highlight_others'] == 1) { foreach ((array) $wp_query->posts as $key => $post_properties) { if (preg_match("/(<pre[^>]*?brush:[^>]*?>)|(\\[source[^\\]]*?language=[^\\]]*?\\])|(\\[code[^\\]]*?language=[^\\]]*?\\])/i", $post_properties->post_content) || preg_match("/<script[^>]*?type=['\"]syntaxhighlighter['\"][^>]*?>/i", $post_properties->post_content)) { $highlight = 1; break; } if ($wp_sh_setting_opt['legacy'] == 1 && $highlight == 0) { if (preg_match("/<[(pre)(textarea)][^>]*?name=['\"]code['\"][^>]*?>/i", $post_properties->post_content)) { $highlight = 1; break; } } } } if (comments_open() && $wp_sh_setting_opt['highlight_comment'] == 1 && $highlight == 0) { $comments = get_comments(array('post_id' => $post->ID, 'status' => '')); foreach ($comments as $comment) { if (preg_match("/(<pre[^>]*?brush:[^>]*?>)|(\\[source[^\\]]*?language=[^\\]]*?\\])|(\\[code[^\\]]*?language=[^\\]]*?\\])/i", $comment->comment_content) || preg_match("/<script[^>]*?type=['\"]syntaxhighlighter['\"][^>]*?>/i", $comment->comment_content)) { $highlight = 1; break; } if ($wp_sh_setting_opt['legacy'] && $highlight == 0) { if (preg_match("/<[(pre)(textarea)][^>]*?name=['\"]code['\"][^>]*?>/i", $comment->comment_content)) { $highlight = 1; break; } } } } if ($wp_sh_setting_opt['highlight_archives'] != 1 && $wp_sh_setting_opt['highlight_bbpress'] == 1 && (function_exists('bbp_is_forum_archive') && bbp_is_forum_archive())) { $highlight = 1; } // Write out scripts if ($highlight == 1) { wp_sh_load_scripts_on_footer(); } else { echo ''; } }
} if ($sidebar_1 != 'None' && $sidebar_2 != 'None') { $body_classes[] = 'double-sidebars'; } } else { $sidebar_1 = get_post_meta($c_pageID, 'sbg_selected_sidebar_replacement', true); $sidebar_2 = get_post_meta($c_pageID, 'sbg_selected_sidebar_2_replacement', true); if (is_array($sidebar_1) && $sidebar_1[0]) { $body_classes[] = 'has-sidebar'; } if (is_array($sidebar_1) && $sidebar_1[0] && is_array($sidebar_2) && $sidebar_2[0]) { $body_classes[] = 'double-sidebars'; } } } if (is_bbpress() && (bbp_is_forum_archive() || bbp_is_topic_archive() || bbp_is_user_home() || bbp_is_search())) { $sidebar_1 = $smof_data['ppbress_sidebar']; $sidebar_2 = $smof_data['ppbress_sidebar_2']; if ($sidebar_1 != 'None') { $body_classes[] = 'has-sidebar'; } if ($sidebar_1 != 'None' && $sidebar_2 != 'None') { $body_classes[] = 'double-sidebars'; } } if (class_exists('TribeEvents') && is_events_archive()) { if ($smof_data['pages_sidebar'] != 'None') { $sidebar_1 = array($smof_data['pages_sidebar']); } else { $sidebar_1 = ''; }
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); }
/** * 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 } elseif (bbp_is_single_user_edit()) { // Current user if (bbp_is_user_home_edit()) { $new_title['text'] = esc_attr__('Edit Your Profile', 'bbpress'); // Other user } else { $new_title['text'] = get_userdata(bbp_get_user_id())->display_name; $new_title['format'] = esc_attr__("Edit %s's Profile", 'bbpress'); } /** Views *****************************************************************/ // Views } elseif (bbp_is_single_view()) { $new_title['text'] = bbp_get_view_title(); $new_title['format'] = esc_attr__('View: %s', 'bbpress'); /** Search ****************************************************************/ // Search } elseif (bbp_is_search()) { $new_title['text'] = bbp_get_search_title(); } // This filter is deprecated. Use 'bbp_before_title_parse_args' instead. $new_title = apply_filters('bbp_raw_title_array', $new_title); // Set title array defaults $new_title = bbp_parse_args($new_title, array('text' => $title, 'format' => '%s'), 'title'); // Get the formatted raw title $new_title = sprintf($new_title['format'], $new_title['text']); // Filter the raw title $new_title = apply_filters('bbp_raw_title', $new_title, $sep, $seplocation); // Compare new title with original title if ($new_title === $title) { return $title; } // Temporary separator, for accurate flipping, if necessary $t_sep = '%WP_TITILE_SEP%'; $prefix = ''; if (!empty($new_title)) { $prefix = " {$sep} "; } // sep on right, so reverse the order if ('right' === $seplocation) { $new_title_array = array_reverse(explode($t_sep, $new_title)); $new_title = implode(" {$sep} ", $new_title_array) . $prefix; // sep on left, do not reverse } else { $new_title_array = explode($t_sep, $new_title); $new_title = $prefix . implode(" {$sep} ", $new_title_array); } // Filter and return return apply_filters('bbp_title', $new_title, $sep, $seplocation); }
function mk_theme_breadcrumbs() { global $mk_options, $post; $post_id = global_get_post_id(); if ($post_id) { $local_skining = get_post_meta($post_id, '_enable_local_backgrounds', true); $breadcrumb_skin = get_post_meta($post_id, '_breadcrumb_skin', true); if ($local_skining == 'true' && !empty($breadcrumb_skin)) { $breadcrumb_skin_class = $breadcrumb_skin; } else { $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; } } else { $breadcrumb_skin_class = $mk_options['breadcrumb_skin']; } $delimiter = ' / '; echo '<div id="mk-breadcrumbs"><div class="mk-breadcrumbs-inner ' . $breadcrumb_skin_class . '-skin">'; if (!is_front_page()) { echo '<a href="'; echo home_url(); echo '">' . __('Home', 'mk_framework'); echo "</a>" . $delimiter; } if (function_exists('is_woocommerce') && is_woocommerce() && is_archive()) { $shop_page_id = wc_get_page_id('shop'); $shop_page = get_post($shop_page_id); $permalinks = get_option('woocommerce_permalinks'); if ($shop_page_id && $shop_page && get_option('page_on_front') !== $shop_page_id) { echo '<a href="' . get_permalink($shop_page) . '">' . $shop_page->post_title . '</a> '; } } if (is_category() && !is_singular('portfolio')) { $category = get_the_category(); $ID = $category[0]->cat_ID; echo is_wp_error($cat_parents = get_category_parents($ID, TRUE, '', FALSE)) ? '' : '<span>' . $cat_parents . '</span>'; } else { if (is_singular('news')) { echo '<span>' . get_the_title() . '</span>'; } else { if (is_single() && !is_attachment()) { if (get_post_type() == 'product') { if ($terms = wc_get_product_terms($post->ID, 'product_cat', array('orderby' => 'parent', 'order' => 'DESC'))) { $main_term = $terms[0]; $ancestors = get_ancestors($main_term->term_id, 'product_cat'); $ancestors = array_reverse($ancestors); foreach ($ancestors as $ancestor) { $ancestor = get_term($ancestor, 'product_cat'); if (!is_wp_error($ancestor) && $ancestor) { echo '<a href="' . get_term_link($ancestor->slug, 'product_cat') . '">' . $ancestor->name . '</a>' . $delimiter; } } echo '<a href="' . get_term_link($main_term->slug, 'product_cat') . '">' . $main_term->name . '</a>' . $delimiter; } echo get_the_title(); } elseif (is_singular('portfolio')) { $portfolio_category = get_the_term_list($post->ID, 'portfolio_category', '', ' / '); if (!empty($portfolio_category)) { echo $portfolio_category . $delimiter; } echo '<span>' . get_the_title() . '</span>'; } elseif (get_post_type() != 'post') { if (function_exists('is_bbpress') && is_bbpress()) { } else { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '<a href="' . get_post_type_archive_link(get_post_type()) . '">' . $post_type->labels->singular_name . '</a>' . $delimiter; echo get_the_title(); } } else { $cat = current(get_the_category()); echo get_category_parents($cat, true, $delimiter); echo get_the_title(); } } elseif (is_page() && !$post->post_parent) { echo get_the_title(); } elseif (is_page() && $post->post_parent) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>'; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($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>"; }
/** * Reset main query vars and filter 'the_content' to output a bbPress * template part as needed. * * @since 2.0.0 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 */ function bbp_template_include_theme_compat($template = '') { /** * Bail if a root template was already found. This prevents unintended * recursive filtering of 'the_content'. * * @link https://bbpress.trac.wordpress.org/ticket/2429 */ if (bbp_is_template_included()) { return $template; } /** * If BuddyPress is activated at a network level, the action order is * reversed, which causes the template integration to fail. If we're looking * at a BuddyPress page here, bail to prevent the extra processing. * * This is a bit more brute-force than is probably necessary, but gets the * job done while we work towards something more elegant. */ if (function_exists('is_buddypress') && is_buddypress()) { return $template; } // Define local variable(s) $bbp_shortcodes = bbpress()->shortcodes; // Bail if shortcodes are unset somehow if (!is_a($bbp_shortcodes, 'BBP_Shortcodes')) { return $template; } /** Users *************************************************************/ if (bbp_is_single_user_edit() || bbp_is_single_user()) { // Reset post bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => bbp_buffer_template_part('content', 'single-user', false), 'post_type' => '', 'post_title' => bbp_get_displayed_user_field('display_name'), 'post_status' => bbp_get_public_status_id(), 'is_single' => true, 'is_archive' => false, 'comment_status' => 'closed')); /** Forums ************************************************************/ // Forum archive } elseif (bbp_is_forum_archive()) { // Page exists where this archive should be $page = bbp_get_page_by_path(bbp_get_root_slug()); // Should we replace the content... if (empty($page->post_content)) { // Use the topics archive if ('topics' === bbp_show_on_root()) { $new_content = $bbp_shortcodes->display_topic_index(); // No page so show the archive } else { $new_content = $bbp_shortcodes->display_forum_index(); } // ...or use the existing page content? } else { $new_content = apply_filters('the_content', $page->post_content); } // Should we replace the title... if (empty($page->post_title)) { // Use the topics archive if ('topics' === bbp_show_on_root()) { $new_title = bbp_get_topic_archive_title(); // No page so show the archive } else { $new_title = bbp_get_forum_archive_title(); } // ...or use the existing page title? } else { $new_title = apply_filters('the_title', $page->post_title); } // Reset post bbp_theme_compat_reset_post(array('ID' => !empty($page->ID) ? $page->ID : 0, 'post_title' => $new_title, 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed')); // Single Forum } elseif (bbp_is_forum_edit()) { // Reset post bbp_theme_compat_reset_post(array('ID' => bbp_get_forum_id(), 'post_title' => bbp_get_forum_title(), 'post_author' => bbp_get_forum_author_id(), 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_forum_form(), 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_forum_visibility(), 'is_single' => true, 'comment_status' => 'closed')); } elseif (bbp_is_single_forum()) { // Reset post bbp_theme_compat_reset_post(array('ID' => bbp_get_forum_id(), 'post_title' => bbp_get_forum_title(), 'post_author' => bbp_get_forum_author_id(), 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_forum(array('id' => bbp_get_forum_id())), 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_forum_visibility(), 'is_single' => true, 'comment_status' => 'closed')); /** Topics ************************************************************/ // Topic archive } elseif (bbp_is_topic_archive()) { // Page exists where this archive should be $page = bbp_get_page_by_path(bbp_get_topic_archive_slug()); // Should we replace the content... if (empty($page->post_content)) { $new_content = $bbp_shortcodes->display_topic_index(); // ...or use the existing page content? } else { $new_content = apply_filters('the_content', $page->post_content); } // Should we replace the title... if (empty($page->post_title)) { $new_title = bbp_get_topic_archive_title(); // ...or use the existing page title? } else { $new_title = apply_filters('the_title', $page->post_title); } // Reset post bbp_theme_compat_reset_post(array('ID' => !empty($page->ID) ? $page->ID : 0, 'post_title' => bbp_get_topic_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed')); // Single Topic } elseif (bbp_is_topic_edit() || bbp_is_single_topic()) { // Split if (bbp_is_topic_split()) { $new_content = bbp_buffer_template_part('form', 'topic-split', false); // Merge } elseif (bbp_is_topic_merge()) { $new_content = bbp_buffer_template_part('form', 'topic-merge', false); // Edit } elseif (bbp_is_topic_edit()) { $new_content = $bbp_shortcodes->display_topic_form(); // Single } else { $new_content = $bbp_shortcodes->display_topic(array('id' => bbp_get_topic_id())); } // Reset post bbp_theme_compat_reset_post(array('ID' => bbp_get_topic_id(), 'post_title' => bbp_get_topic_title(), 'post_author' => bbp_get_topic_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_topic_status(), 'is_single' => true, 'comment_status' => 'closed')); /** Replies ***********************************************************/ // Reply archive } elseif (is_post_type_archive(bbp_get_reply_post_type())) { // Reset post bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Replies', 'bbpress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_reply_index(), 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed')); // Single Reply } elseif (bbp_is_reply_edit() || bbp_is_single_reply()) { // Move if (bbp_is_reply_move()) { $new_content = bbp_buffer_template_part('form', 'reply-move', false); // Edit } elseif (bbp_is_reply_edit()) { $new_content = $bbp_shortcodes->display_reply_form(); // Single } else { $new_content = $bbp_shortcodes->display_reply(array('id' => get_the_ID())); } // Reset post bbp_theme_compat_reset_post(array('ID' => bbp_get_reply_id(), 'post_title' => bbp_get_reply_title(), 'post_author' => bbp_get_reply_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_reply_status(), 'comment_status' => 'closed')); /** Views *************************************************************/ } elseif (bbp_is_single_view()) { // Reset post bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_view_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_view(array('id' => get_query_var(bbp_get_view_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed')); /** Search ************************************************************/ } elseif (bbp_is_search()) { // Reset post bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_search_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_search(array('search' => get_query_var(bbp_get_search_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed')); /** Topic Tags ********************************************************/ // Topic Tag Edit } elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) { // Stash the current term in a new var set_query_var('bbp_topic_tag', get_query_var('term')); // Show topics of tag if (bbp_is_topic_tag()) { $new_content = $bbp_shortcodes->display_topics_of_tag(array('id' => bbp_get_topic_tag_id())); // Edit topic tag } elseif (bbp_is_topic_tag_edit()) { $new_content = $bbp_shortcodes->display_topic_tag_form(); } // Reset the post with our new title bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => '', 'post_title' => sprintf(__('Topic Tag: %s', 'bbpress'), '<span>' . bbp_get_topic_tag_name() . '</span>'), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed', 'is_tax' => true)); } /** * Bail if the template already matches a bbPress template. This includes * archive-* and single-* WordPress post_type matches (allowing * themes to use the expected format) as well as all bbPress-specific * template files for users, topics, forums, etc... * * We do this after the above checks to prevent incorrect 404 body classes * and header statuses, as well as to set the post global as needed. * * @see https://bbpress.trac.wordpress.org/ticket/1478/ */ if (bbp_is_template_included()) { return $template; /** * If we are relying on bbPress's built in theme compatibility to load * the proper content, we need to intercept the_content, replace the * output, and display ours instead. * * To do this, we first remove all filters from 'the_content' and hook * our own function into it, which runs a series of checks to determine * the context, and then uses the built in shortcodes to output the * correct results from inside an output buffer. * * Uses bbp_get_theme_compat_templates() to provide fall-backs that * should be coded without superfluous mark-up and logic (prev/next * navigation, comments, date/time, etc...) * * Hook into the 'bbp_get_bbpress_template' to override the array of * possible templates, or 'bbp_bbpress_template' to override the result. */ } elseif (bbp_is_theme_compat_active()) { bbp_remove_all_filters('the_content'); $template = bbp_get_theme_compat_templates(); } return apply_filters('bbp_template_include_theme_compat', $template); }
/** * Runs through the various bbPress conditional tags to check the current page being viewed. Once * a condition is met, add items to the $items array. * * @since 0.6.0 * @access public * @return void */ public function do_trail_items() { /* Add the network and site home links. */ $this->do_network_home_link(); $this->do_site_home_link(); /* 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()) { $this->items[] = '<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()) { if (true === $this->args['show_title']) { $this->items[] = bbp_get_forum_archive_title(); } } elseif (bbp_is_topic_archive()) { if (true === $this->args['show_title']) { $this->items[] = bbp_get_topic_archive_title(); } } elseif (bbp_is_topic_tag()) { if (true === $this->args['show_title']) { $this->items[] = bbp_get_topic_tag_name(); } } elseif (bbp_is_topic_tag_edit()) { $this->items[] = '<a href="' . bbp_get_topic_tag_link() . '">' . bbp_get_topic_tag_name() . '</a>'; if (true === $this->args['show_title']) { $this->items[] = __('Edit', 'breadcrumb-trail'); } } elseif (bbp_is_single_view()) { if (true === $this->args['show_title']) { $this->items[] = bbp_get_view_title(); } } 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). */ $this->do_post_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()) { $this->items[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>'; } elseif (true === $this->args['show_title']) { $this->items[] = bbp_get_topic_title($topic_id); } /* If viewing a topic split page. */ if (bbp_is_topic_split() && true === $this->args['show_title']) { $this->items[] = __('Split', 'breadcrumb-trail'); } elseif (bbp_is_topic_merge() && true === $this->args['show_title']) { $this->items[] = __('Merge', 'breadcrumb-trail'); } elseif (bbp_is_topic_edit() && true === $this->args['show_title']) { $this->items[] = __('Edit', 'breadcrumb-trail'); } } 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. */ $this->do_post_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()) { $this->items[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>'; if (true === $this->args['show_title']) { $this->items[] = __('Edit', 'breadcrumb-trail'); } } elseif (true === $this->args['show_title']) { $this->items[] = bbp_get_reply_title($reply_id); } } 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) { $this->do_post_parents($forum_parent_id); } /* Add the forum title to the end of the trail. */ if (true === $this->args['show_title']) { $this->items[] = bbp_get_forum_title($forum_id); } } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) { if (bbp_is_single_user_edit()) { $this->items[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>'; if (true === $this->args['show_title']) { $this->items[] = __('Edit', 'breadcrumb-trail'); } } elseif (true === $this->args['show_title']) { $this->items[] = bbp_get_displayed_user_field('display_name'); } } /* Return the bbPress breadcrumb trail items. */ $this->items = apply_filters('breadcrumb_trail_get_bbpress_items', $this->items, $this->args); }
function wm_section_heading($args = array()) { //Helper variables global $post, $page, $paged, $wp_query; if (!isset($paged)) { $paged = 0; } if (!isset($page)) { $page = 0; } $paginated = max($paged, $page); $blog_page_id = get_option('page_for_posts'); $page_id = is_home() ? $blog_page_id : null; $disable_heading = false; if (function_exists('wma_meta_option') && wma_meta_option('disable-heading', $page_id) || !function_exists('wma_meta_option') && is_front_page()) { $disable_heading = true; } //WooCommerce support $wc_shop = false; if (class_exists('WooCommerce')) { if (is_woocommerce() || is_cart() || is_checkout()) { $wc_shop = true; } if (is_shop()) { $page_id = wc_get_page_id('shop'); } } //Requirements check if (is_home() && !$blog_page_id || $disable_heading) { return; } $output = ''; $defaults = array('addons' => '', 'class' => 'main-heading entry-header wrap clearfix', 'link' => get_permalink($page_id), 'page_id' => $page_id, 'paged' => array($paginated, $paged, $page), 'output' => "\r\n\r\n" . '<header id="main-heading" class="{class}">' . "\r\n" . apply_filters('wmhook_section_inner_wrappers', '') . '<{tag} class="entry-title"' . wm_schema_org('name') . '>{title}</{tag}>{addons}' . apply_filters('wmhook_section_inner_wrappers_close', '') . "\r\n" . '</header>' . "\r\n", 'tag' => 'h1', 'title' => 2 > $paginated ? get_the_title($page_id) : '<a href="' . get_permalink($page_id) . '">' . get_the_title($page_id) . '</a>'); //Link on tax, category and tag archive if (is_tax() || is_category() || is_tag()) { global $wp_query; $term = $wp_query->get_queried_object(); $defaults['link'] = get_term_link($term); } elseif (is_archive()) { $defaults['link'] = ''; } $defaults = apply_filters('wmhook_wm_section_heading_defaults', $defaults); $args = wp_parse_args($args, $defaults); //Preparing output //Archives if (is_day()) { $args['title'] = sprintf(__('Daily Archives: <strong>%s</strong>', 'mustang'), get_the_date()); } elseif (is_month()) { $args['title'] = sprintf(__('Monthly Archives: <strong>%s</strong>', 'mustang'), get_the_date(_x('F Y', 'monthly archives date format', 'mustang'))); } elseif (is_year()) { $args['title'] = sprintf(__('Yearly Archives: <strong>%s</strong>', 'mustang'), get_the_date(_x('Y', 'yearly archives date format', 'mustang'))); } elseif (is_category()) { $args['title'] = sprintf(__('Category Archives: <strong>%s</strong>', 'mustang'), single_cat_title('', false)); } elseif (is_tag()) { $args['title'] = sprintf(__('Tag Archives: <strong>%s</strong>', 'mustang'), single_tag_title('', false)); } elseif (is_search()) { $args['title'] = sprintf(__('Search Results for: <strong>%s</strong>', 'mustang'), get_search_query()); } elseif (is_author()) { $author = get_userdata(get_query_var('author')); $args['title'] = sprintf(__('<strong>%s</strong> archives', 'mustang'), $author->display_name); } elseif (is_tax()) { $args['title'] = single_term_title('', false); } elseif (is_archive()) { $args['title'] = __('Archives', 'mustang'); } if (is_category() || is_tag() || is_tax()) { $term_description = term_description(); if (!empty($term_description)) { $args['addons'] .= sprintf('<div class="taxonomy-description" title="%2$s">%1$s</div>', $term_description, esc_attr(sprintf('Description of "%s"', single_term_title('', false)))); } } //Single post if (is_singular('post') && $blog_page_id) { $args['title'] = '<a href="' . get_permalink($blog_page_id) . '">' . get_the_title($blog_page_id) . '</a>'; $args['class'] = str_replace(' entry-header', '', $args['class']); $args['output'] = str_replace(' class="entry-title"', '', $args['output']); } //Parted article / pagination suffix if (!(is_singular('post') && $blog_page_id)) { if (1 < $args['paged'][2]) { $args['title'] = '<a href="' . $args['link'] . '">' . $args['title'] . '</a>' . wm_paginated_suffix('small'); } elseif (1 < $args['paged'][1]) { $args['title'] .= wm_paginated_suffix('small'); } } //404 page if (is_404()) { $args['title'] = __('Error 404', 'mustang'); } //bbPress support if (class_exists('bbPress')) { if (bbp_is_forum_archive()) { $args['title'] = sprintf(__('%s forums', 'mustang'), get_bloginfo('name')); } if (bbp_is_single_forum() && !bbp_is_forum_category()) { $args['title'] = sprintf(__('Forum: %s', 'mustang'), $args['title']); } if (bbp_is_single_topic()) { $args['title'] = sprintf(__('Topic: %s', 'mustang'), $args['title']); } } //WooCommerce support if ($wc_shop && !is_tax()) { $args['title'] = 2 > $paginated ? get_the_title($page_id) : '<a href="' . get_permalink($page_id) . '">' . get_the_title($page_id) . '</a>'; if (is_search()) { $args['title'] .= sprintf(__(' / Results for: <strong>%s</strong>', 'mustang'), get_search_query()); } } //Addons $widget_area_atts = apply_filters('wmhook_wm_section_heading_widget_area_atts', array('max_widgets_count' => 2, 'sidebar' => 'main-heading-widgets')); $widget_area = ''; if (function_exists('wma_sidebar')) { $widget_area = wma_sidebar($widget_area_atts); } if ($widget_area) { $args['addons'] .= '<div class="main-heading-widgets">' . $widget_area . '</div>'; $args['class'] .= ' has-widgets'; } //Filter processed $args $args = apply_filters('wmhook_wm_section_heading_args', $args); //Generating output HTML $replacements = array('{addons}' => do_shortcode($args['addons']), '{class}' => esc_attr($args['class']), '{tag}' => esc_attr($args['tag']), '{title}' => do_shortcode($args['title'])); $output = strtr($args['output'], $replacements); //Output echo apply_filters('wmhook_wm_section_heading_output', $output); }
/** * Replaces the_content() if the post_type being displayed is one that would * normally be handled by bbPress, but proper single page templates do not * exist in the currently active theme. * * Note that we do *not* currently use is_main_query() here. This is because so * many existing themes either use query_posts() or fail to use wp_reset_query() * when running queries before the main loop, causing theme compat to fail. * * @since bbPress (r3034) * @param string $content * @return type */ function bbp_replace_the_content($content = '') { // Bail if not inside the query loop if (!in_the_loop()) { return $content; } $bbp = bbpress(); // Define local variable(s) $new_content = ''; // Bail if shortcodes are unset somehow if (!is_a($bbp->shortcodes, 'BBP_Shortcodes')) { return $content; } // Use shortcode API to display forums/topics/replies because they are // already output buffered and ready to fit inside the_content /** Users *************************************************************/ // Profile View if (bbp_is_single_user_edit() || bbp_is_single_user()) { ob_start(); bbp_get_template_part('content', 'single-user'); $new_content = ob_get_contents(); ob_end_clean(); /** Forums ************************************************************/ // Forum archive } elseif (bbp_is_forum_archive()) { // Page exists where this archive should be $page = bbp_get_page_by_path(bbp_get_root_slug()); if (!empty($page)) { // Restore previously unset filters bbp_restore_all_filters('the_content'); // Remove 'bbp_replace_the_content' filter to prevent infinite loops remove_filter('the_content', 'bbp_replace_the_content'); // Start output buffer ob_start(); // Grab the content of this page $new_content = apply_filters('the_content', $page->post_content); // Clean up the buffer ob_end_clean(); // Add 'bbp_replace_the_content' filter back (@see $this::start()) add_filter('the_content', 'bbp_replace_the_content'); // No page so show the archive } else { $new_content = $bbp->shortcodes->display_forum_index(); } // Forum Edit } elseif (bbp_is_forum_edit()) { $new_content = $bbp->shortcodes->display_forum_form(); // Single Forum } elseif (bbp_is_single_forum()) { $new_content = $bbp->shortcodes->display_forum(array('id' => get_the_ID())); /** Topics ************************************************************/ // Topic archive } elseif (bbp_is_topic_archive()) { // Page exists where this archive should be $page = bbp_get_page_by_path(bbp_get_topic_archive_slug()); if (!empty($page)) { // Restore previously unset filters bbp_restore_all_filters('the_content'); // Remove 'bbp_replace_the_content' filter to prevent infinite loops remove_filter('the_content', 'bbp_replace_the_content'); // Start output buffer ob_start(); // Grab the content of this page $new_content = apply_filters('the_content', $page->post_content); // Clean up the buffer ob_end_clean(); // Add 'bbp_replace_the_content' filter back (@see $this::start()) add_filter('the_content', 'bbp_replace_the_content'); // No page so show the archive } else { $new_content = $bbp->shortcodes->display_topic_index(); } // Topic Edit } elseif (bbp_is_topic_edit()) { // Split if (bbp_is_topic_split()) { ob_start(); bbp_get_template_part('form', 'topic-split'); $new_content = ob_get_contents(); ob_end_clean(); // Merge } elseif (bbp_is_topic_merge()) { ob_start(); bbp_get_template_part('form', 'topic-merge'); $new_content = ob_get_contents(); ob_end_clean(); // Edit } else { $new_content = $bbp->shortcodes->display_topic_form(); } // Single Topic } elseif (bbp_is_single_topic()) { $new_content = $bbp->shortcodes->display_topic(array('id' => get_the_ID())); /** Replies ***********************************************************/ // Reply archive } elseif (is_post_type_archive(bbp_get_reply_post_type())) { //$new_content = $bbp->shortcodes->display_reply_index(); // Reply Edit } elseif (bbp_is_reply_edit()) { $new_content = $bbp->shortcodes->display_reply_form(); // Single Reply } elseif (bbp_is_single_reply()) { $new_content = $bbp->shortcodes->display_reply(array('id' => get_the_ID())); /** Views *************************************************************/ } elseif (bbp_is_single_view()) { $new_content = $bbp->shortcodes->display_view(array('id' => get_query_var('bbp_view'))); /** Topic Tags ********************************************************/ // Show topics of tag } elseif (bbp_is_topic_tag()) { $new_content = $bbp->shortcodes->display_topics_of_tag(array('id' => bbp_get_topic_tag_id())); // Edit topic tag } elseif (bbp_is_topic_tag_edit()) { $new_content = $bbp->shortcodes->display_topic_tag_form(); } // Juggle the content around and try to prevent unsightly comments if (!empty($new_content) && $new_content != $content) { // Set the content to be the new content $content = apply_filters('bbp_replace_the_content', $new_content, $content); // Clean up after ourselves unset($new_content); // Reset the $post global wp_reset_postdata(); } // Return possibly hi-jacked content return $content; }
the_post(); if (has_excerpt()) { the_excerpt(); } } } } elseif (class_exists('WooCommerce') and is_shop() || is_singular('product') || is_tax('product_cat') || is_tax('product_tag')) { if (hippo_option('shop-short-description')) { ?> <p><?php echo wp_kses(hippo_option('shop-short-description'), array('a' => array('href' => array(), 'title' => array(), 'class' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'ul' => array('class' => array()), 'li' => array('class' => array()), 'p' => array('class' => array()), 'span' => array('class' => array()))); ?> </p> <?php } } elseif (function_exists('is_bbpress') and is_bbpress() || bbp_is_forum_archive() || bbp_is_topic_archive() || bbp_is_topic_tag() || bbp_is_single_forum() || bbp_is_single_topic() || bbp_is_single_user() || bbp_is_search()) { if (hippo_option('forum-short-description')) { ?> <p><?php echo wp_kses(hippo_option('forum-short-description'), array('a' => array('href' => array(), 'title' => array(), 'class' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'ul' => array('class' => array()), 'li' => array('class' => array()), 'p' => array('class' => array()), 'span' => array('class' => array()))); ?> </p> <?php } } else { if (hippo_option('blog-short-description')) { ?> <p><?php echo wp_kses(hippo_option('blog-short-description'), array('a' => array('href' => array(), 'title' => array(), 'class' => array()), 'br' => array(), 'em' => array(), 'strong' => array(), 'ul' => array('class' => array()), 'li' => array('class' => array()), 'p' => array('class' => array()), 'span' => array('class' => array()))); ?>
/** * 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()) { $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, 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[] = '<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', 'theme_front'); } elseif (bbp_is_topic_merge()) { $item[] = __('Merge', 'theme_front'); } elseif (bbp_is_topic_edit()) { $item[] = __('Edit', 'theme_front'); } } 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[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>'; $item[] = __('Edit', 'theme_front'); } } elseif (bbp_is_single_forum()) { $forum_id = get_queried_object_id(); $forum_parent_id = bbp_get_forum_parent($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[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>'; $item[] = __('Edit'); } else { $item[] = bbp_get_displayed_user_field('display_name'); } } return apply_filters('breadcrumbs_plus_get_bbpress_items', $item, $args); }
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; }
function bpp_enforce_permissions() { // Bail if not viewing a bbPress item if (!is_bbpress()) { return; } // Bail if not viewing a single item or if user has caps if (!is_singular() || bbp_is_user_keymaster() || current_user_can('read_hidden_forums') || bbp_is_forum_archive()) { return; } global $post; if (!$this->bpp_can_user_view_post($post->ID)) { if (!is_user_logged_in()) { if (is_numeric($this->temp)) { $link = get_permalink($this->temp) . '?error=not-accessible'; wp_redirect($link, '302'); exit; } else { auth_redirect(); } } else { if (is_numeric($this->temp)) { wp_safe_redirect(get_permalink($this->temp) . '?error=not-accessible', '302'); } else { bbp_set_404(); } } } }
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; }
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(); } } } } } } } } } } }
echo vp_metabox('general_settings.hb_page_title_h1', null, $post_id); } else { the_title(); } } } } } } } } ?> </h1> <?php if (class_exists('bbPress') && !bbp_is_forum_archive() || !class_exists('bbPress')) { ?> <?php if (vp_metabox('general_settings.hb_page_subtitle') || is_search() || is_archive()) { ?> <br/> <h2 class="<?php echo $page_subtitle_animation; ?> "> <?php if (is_search()) { if ($wp_query->found_posts == 0) { _e('No results found', 'hbthemes'); } else { if ($wp_query->found_posts == 1) {
function memberlite_getBreadcrumbs() { $page_breadcrumbs = get_theme_mod('page_breadcrumbs', false); $post_breadcrumbs = get_theme_mod('post_breadcrumbs', false); $archive_breadcrumbs = get_theme_mod('archive_breadcrumbs', false); $attachment_breadcrumbs = get_theme_mod('attachment_breadcrumbs', false); $search_breadcrumbs = get_theme_mod('search_breadcrumbs', false); $profile_breadcrumbs = get_theme_mod('profile_breadcrumbs', false); $show_breadcrumbs = '' != $page_breadcrumbs || '' != $post_breadcrumbs || '' != $archive_breadcrumbs || '' != $attachment_breadcrumbs || '' != $search_breadcrumbs || '' != $profile_breadcrumbs ? true : false; global $posts, $post, $memberlite_defaults; if ($show_breadcrumbs) { if (function_exists('is_woocommerce') && is_woocommerce()) { } elseif (function_exists('is_bbpress') && is_bbpress()) { ?> <nav class="memberlite-breadcrumb" itemprop="breadcrumb"> <?php /* Displays bbp_breadcrumb in theme masthead */ remove_filter('bbp_no_breadcrumb', '__return_true'); echo bbp_breadcrumb(); add_filter('bbp_no_breadcrumb', '__return_true'); ?> </nav> <?php } elseif (is_attachment() && '' != $attachment_breadcrumbs) { ?> <nav class="memberlite-breadcrumb" itemprop="breadcrumb"> <a href="<?php echo home_url(); ?> "><?php _e('Home', 'memberlite'); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php global $post; $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '" title="">' . get_the_title($page->ID) . '</a><span class="sep">' . $memberlite_defaults['delimiter'] . '</span>'; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) { echo $crumb; } ?> <?php the_title(); ?> </nav> <?php } elseif (is_page() && !is_front_page() && !is_attachment() && '' != $page_breadcrumbs) { ?> <nav class="memberlite-breadcrumb" itemprop="breadcrumb"> <a href="<?php echo home_url(); ?> "><?php _e('Home', 'memberlite'); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php $breadcrumbs = get_post_ancestors($post->ID); if ($breadcrumbs) { $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) { ?> <a href="<?php echo get_permalink($crumb); ?> "><?php echo get_the_title($crumb); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php } } ?> <?php if (function_exists("pmpro_getOption") && is_page(array(pmpro_getOption('cancel_page_id'), pmpro_getOption('billing_page_id'), pmpro_getOption('confirmation_page_id'), pmpro_getOption('invoice_page_id'))) && !in_array(pmpro_getOption('account_page_id'), get_post_ancestors($post->ID))) { ?> <a href="<?php echo get_permalink(pmpro_getOption('account_page_id')); ?> "><?php echo get_the_title(pmpro_getOption('account_page_id')); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php } ?> <?php the_title(); ?> </nav> <?php } elseif ((is_author() || is_tag() || is_archive()) && '' != $archive_breadcrumbs) { ?> <nav class="memberlite-breadcrumb" itemprop="breadcrumb"> <a href="<?php echo get_option('home'); ?> /"><?php _e('Home', 'memberlite'); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php if (get_option('page_for_posts')) { ?> <a href="<?php echo get_permalink(get_option('page_for_posts')); ?> "><?php echo get_the_title(get_option('page_for_posts')); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php } ?> <?php if (is_category()) { single_cat_title(); } elseif (is_tag()) { $current_tag = single_tag_title("", false); printf(__('Posts Tagged: %s', 'memberlite'), '<span>' . $current_tag . '</span>'); } elseif (is_author()) { printf(__('Author: %s', 'memberlite'), '<span class="vcard">' . get_the_author() . '</span>'); } elseif (is_day()) { printf(__('Day: %s', 'memberlite'), '<span>' . get_the_date() . '</span>'); } elseif (is_month()) { printf(__('Month: %s', 'memberlite'), '<span>' . get_the_date(_x('F Y', 'monthly archives date format', 'memberlite')) . '</span>'); } elseif (is_year()) { printf(__('Year: %s', 'memberlite'), '<span>' . get_the_date(_x('Y', 'yearly archives date format', 'memberlite')) . '</span>'); } elseif (is_tax('post_format', 'post-format-aside')) { _e('Asides', 'memberlite'); } elseif (is_tax('post_format', 'post-format-gallery')) { _e('Galleries', 'memberlite'); } elseif (is_tax('post_format', 'post-format-image')) { _e('Images', 'memberlite'); } elseif (is_tax('post_format', 'post-format-video')) { _e('Videos', 'memberlite'); } elseif (is_tax('post_format', 'post-format-quote')) { _e('Quotes', 'memberlite'); } elseif (is_tax('post_format', 'post-format-link')) { _e('Links', 'memberlite'); } elseif (is_tax('post_format', 'post-format-status')) { _e('Statuses', 'memberlite'); } elseif (is_tax('post_format', 'post-format-audio')) { _e('Audios', 'memberlite'); } elseif (is_tax('post_format', 'post-format-chat')) { _e('Chats', 'memberlite'); } elseif (bbp_is_forum_archive()) { _e('Forums', 'memberlite'); } else { _e('Archives', 'memberlite'); } ?> </nav> <?php } elseif (is_single() && '' != $post_breadcrumbs) { ?> <nav class="memberlite-breadcrumb" itemprop="breadcrumb"> <a href="<?php echo home_url(); ?> "><?php _e('Home', 'memberlite'); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php if (get_option('page_for_posts')) { ?> <a href="<?php echo get_permalink(get_option('page_for_posts')); ?> "><?php echo get_the_title(get_option('page_for_posts')); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php } ?> <?php the_title(); ?> </nav> <?php } elseif (is_search() && '' != $search_breadcrumbs) { ?> <nav class="memberlite-breadcrumb" itemprop="breadcrumb"> <a href="<?php echo home_url(); ?> "><?php _e('Home', 'memberlite'); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php if (get_option('page_for_posts')) { ?> <a href="<?php echo get_permalink(get_option('page_for_posts')); ?> "><?php echo get_the_title(get_option('page_for_posts')); ?> </a> <span class="sep"><?php echo $memberlite_defaults['delimiter']; ?> </span> <?php } ?> <?php _e('Search Results For', 'memberlite'); ?> '<?php the_search_query(); ?> ' </nav> <?php } } }
/** * 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); $title = $prefix . implode(" {$sep} ", $title_array); } // Filter and return return apply_filters('bbp_title', $title, $sep, $seplocation); }
/** * Calculate any extra classes for the <body> element. * These are then added using the 'body_class' filter. * Documentation: ttps://codex.wordpress.org/Plugin_API/Filter_Reference/body_class */ public function body_classes($classes) { $sidebar_1 = $this->sidebar_context(1); $sidebar_2 = $this->sidebar_context(2); $c_pageID = Avada::c_pageID(); $classes[] = 'fusion-body'; if (is_page_template('blank.php')) { $classes[] = 'body_blank'; } if (!Avada()->settings->get('header_sticky_tablet')) { $classes[] = 'no-tablet-sticky-header'; } if (!Avada()->settings->get('header_sticky_mobile')) { $classes[] = 'no-mobile-sticky-header'; } if (Avada()->settings->get('mobile_slidingbar_widgets')) { $classes[] = 'no-mobile-slidingbar'; } if (Avada()->settings->get('status_totop')) { $classes[] = 'no-totop'; } if (!Avada()->settings->get('status_totop_mobile')) { $classes[] = 'no-mobile-totop'; } if ('horizontal' == Avada()->settings->get('woocommerce_product_tab_design') && is_singular('product')) { $classes[] = 'woo-tabs-horizontal'; } if ('modern' == Avada()->settings->get('mobile_menu_design')) { $classes[] = 'mobile-logo-pos-' . strtolower(Avada()->settings->get('logo_alignment')); } if ('Boxed' == Avada()->settings->get('layout') && 'default' == get_post_meta($c_pageID, 'pyre_page_bg_layout', true) || 'boxed' == get_post_meta($c_pageID, 'pyre_page_bg_layout', true)) { $classes[] = 'layout-boxed-mode'; } else { $classes[] = 'layout-wide-mode'; } if (is_array($sidebar_1) && !empty($sidebar_1) && ($sidebar_1[0] || '0' == $sidebar_1[0]) && !is_buddypress() && !is_bbpress() && !is_page_template('100-width.php') && (!class_exists('WooCommerce') || class_exists('WooCommerce') && !is_cart() && !is_checkout() && !is_account_page() && !(get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id'))))) { $classes[] = 'has-sidebar'; } if (is_array($sidebar_1) && $sidebar_1[0] && is_array($sidebar_2) && $sidebar_2[0] && !is_buddypress() && !is_bbpress() && !is_page_template('100-width.php') && (!class_exists('WooCommerce') || class_exists('WooCommerce') && !is_cart() && !is_checkout() && !is_account_page() && !(get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id'))))) { $classes[] = 'double-sidebars'; } if (is_page_template('side-navigation.php') && is_array($sidebar_2) && $sidebar_2[0]) { $classes[] = 'double-sidebars'; } if (is_home()) { if ('None' != $sidebar_1) { $classes[] = 'has-sidebar'; } if ('None' != $sidebar_1 && 'None' != $sidebar_2) { $classes[] = 'double-sidebars'; } } if (is_archive() && (!is_buddypress() && !is_bbpress() && (class_exists('WooCommerce') && !is_shop()) || !class_exists('WooCommerce')) && !is_tax('portfolio_category') && !is_tax('portfolio_skills') && !is_tax('portfolio_tags') && !is_tax('product_cat') && !is_tax('product_tag')) { if ('None' != $sidebar_1) { $classes[] = 'has-sidebar'; } if ('None' != $sidebar_1 && 'None' != $sidebar_2) { $classes[] = 'double-sidebars'; } } if (is_tax('portfolio_category') || is_tax('portfolio_skills') || is_tax('portfolio_tags')) { if ('None' != $sidebar_1) { $classes[] = 'has-sidebar'; } if ('None' != $sidebar_1 && 'None' != $sidebar_2) { $classes[] = 'double-sidebars'; } } if (is_tax('product_cat') || is_tax('product_tag')) { if ('None' != $sidebar_1) { $classes[] = 'has-sidebar'; } if ('None' != $sidebar_1 && 'None' != $sidebar_2) { $classes[] = 'double-sidebars'; } } if (is_search()) { if ('None' != $sidebar_1) { $classes[] = 'has-sidebar'; } if ('None' != $sidebar_1 && 'None' != $sidebar_2) { $classes[] = 'double-sidebars'; } } if ((is_bbpress() || is_buddypress()) && !bbp_is_forum_archive() && !bbp_is_topic_archive() && !bbp_is_user_home() && !bbp_is_search()) { if (Avada()->settings->get('bbpress_global_sidebar')) { if ('None' != $sidebar_1) { $classes[] = 'has-sidebar'; } if ('None' != $sidebar_1 && 'None' != $sidebar_2) { $classes[] = 'double-sidebars'; } } else { if (is_array($sidebar_1) && $sidebar_1[0]) { $classes[] = 'has-sidebar'; } if (is_array($sidebar_1) && $sidebar_1[0] && is_array($sidebar_2) && $sidebar_2[0]) { $classes[] = 'double-sidebars'; } } } if ((is_bbpress() || is_buddypress()) && (bbp_is_forum_archive() || bbp_is_topic_archive() || bbp_is_user_home() || bbp_is_search())) { if ('None' != $sidebar_1) { $classes[] = 'has-sidebar'; } if ('None' != $sidebar_1 && 'None' != $sidebar_2) { $classes[] = 'double-sidebars'; } } if (class_exists('Tribe__Events__Main') && is_events_archive()) { if (is_array($sidebar_1) && $sidebar_1[0] && !is_bbpress() && !is_page_template('100-width.php') && (!class_exists('WooCommerce') || class_exists('WooCommerce') && !is_cart() && !is_checkout() && !is_account_page() && !(get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id'))))) { $classes[] = 'has-sidebar'; } if (is_array($sidebar_1) && $sidebar_1[0] && is_array($sidebar_2) && $sidebar_2[0] && !is_bbpress() && !is_page_template('100-width.php') && (!class_exists('WooCommerce') || class_exists('WooCommerce') && !is_cart() && !is_checkout() && !is_account_page() && !(get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id'))))) { $classes[] = 'double-sidebars'; } } if ('no' != get_post_meta($c_pageID, 'pyre_display_header', true)) { if ('Left' == Avada()->settings->get('header_position') || 'Right' == Avada()->settings->get('header_position')) { $classes[] = 'side-header'; } if ('Left' == Avada()->settings->get('header_position')) { $classes[] = 'side-header-left'; } elseif ('Right' == Avada()->settings->get('header_position')) { $classes[] = 'side-header-right'; } $classes[] = 'menu-text-align-' . strtolower(Avada()->settings->get('menu_text_align')); } $classes[] = 'mobile-menu-design-' . Avada()->settings->get('mobile_menu_design'); return $classes; }
/** * The main topic loop. WordPress makes this easy for us * * @since 2.0.0 bbPress (r2485) * * @param array $args All the arguments supported by {@link WP_Query} * @uses current_user_can() To check if the current user can edit other's topics * @uses bbp_get_topic_post_type() To get the topic post type * @uses WP_Query To make query and get the topics * @uses is_page() To check if it's a page * @uses bbp_is_single_forum() To check if it's a forum * @uses bbp_get_forum_id() To get the forum id * @uses bbp_get_paged() To get the current page value * @uses bbp_get_super_stickies() To get the super stickies * @uses bbp_get_stickies() To get the forum stickies * @uses bbp_use_pretty_urls() To check if the site is using pretty URLs * @uses get_permalink() To get the permalink * @uses add_query_arg() To add custom args to the url * @uses apply_filters() Calls 'bbp_topics_pagination' with the pagination args * @uses paginate_links() To paginate the links * @uses apply_filters() Calls 'bbp_has_topics' with * bbPres::topic_query::have_posts() * and bbPres::topic_query * @return object Multidimensional array of topic information */ function bbp_has_topics($args = array()) { /** Defaults **************************************************************/ // Other defaults $default_topic_search = !empty($_REQUEST['ts']) ? $_REQUEST['ts'] : false; $default_show_stickies = (bool) (bbp_is_single_forum() || bbp_is_topic_archive()) && false === $default_topic_search; $default_post_parent = bbp_is_single_forum() ? bbp_get_forum_id() : 'any'; // Default argument array $default = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => $default_post_parent, 'meta_key' => '_bbp_last_active_time', 'meta_type' => 'DATETIME', 'orderby' => 'meta_value', 'order' => 'DESC', 'posts_per_page' => bbp_get_topics_per_page(), 'paged' => bbp_get_paged(), 'show_stickies' => $default_show_stickies, 'max_num_pages' => false); // Only add 's' arg if searching for topics // See https://bbpress.trac.wordpress.org/ticket/2607 if (!empty($default_topic_search)) { $default['s'] = $default_topic_search; } // What are the default allowed statuses (based on user caps) if (bbp_get_view_all()) { // Default view=all statuses $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id(), bbp_get_pending_status_id()); // Add support for private status if (current_user_can('read_private_topics')) { $post_statuses[] = bbp_get_private_status_id(); } // Join post statuses together $default['post_status'] = implode(',', $post_statuses); // Lean on the 'perm' query var value of 'readable' to provide statuses } else { $default['perm'] = 'readable'; } // Maybe query for topic tags if (bbp_is_topic_tag()) { $default['term'] = bbp_get_topic_tag_slug(); $default['taxonomy'] = bbp_get_topic_tag_tax_id(); } /** Setup *****************************************************************/ // Parse arguments against default values $r = bbp_parse_args($args, $default, 'has_topics'); // Get bbPress $bbp = bbpress(); // Call the query $bbp->topic_query = new WP_Query($r); // Set post_parent back to 0 if originally set to 'any' if ('any' === $r['post_parent']) { $r['post_parent'] = 0; } // Limited the number of pages shown if (!empty($r['max_num_pages'])) { $bbp->topic_query->max_num_pages = $r['max_num_pages']; } /** Stickies **************************************************************/ // Put sticky posts at the top of the posts array if (!empty($r['show_stickies']) && $r['paged'] <= 1) { // Get super stickies and stickies in this forum $stickies = bbp_get_super_stickies(); // Get stickies for current forum if (!empty($r['post_parent'])) { $stickies = array_merge($stickies, bbp_get_stickies($r['post_parent'])); } // Remove any duplicate stickies $stickies = array_unique($stickies); // We have stickies if (is_array($stickies) && !empty($stickies)) { // Start the offset at -1 so first sticky is at correct 0 offset $sticky_offset = -1; // Loop over topics and relocate stickies to the front. foreach ($stickies as $sticky_index => $sticky_ID) { // Get the post offset from the posts array $post_offsets = wp_filter_object_list($bbp->topic_query->posts, array('ID' => $sticky_ID), 'OR', 'ID'); // Continue if no post offsets if (empty($post_offsets)) { continue; } // Loop over posts in current query and splice them into position foreach (array_keys($post_offsets) as $post_offset) { $sticky_offset++; $sticky = $bbp->topic_query->posts[$post_offset]; // Remove sticky from current position array_splice($bbp->topic_query->posts, $post_offset, 1); // Move to front, after other stickies array_splice($bbp->topic_query->posts, $sticky_offset, 0, array($sticky)); // Cleanup unset($stickies[$sticky_index]); unset($sticky); } // Cleanup unset($post_offsets); } // Cleanup unset($sticky_offset); // If any posts have been excluded specifically, Ignore those that are sticky. if (!empty($stickies) && !empty($r['post__not_in'])) { $stickies = array_diff($stickies, $r['post__not_in']); } // Fetch sticky posts that weren't in the query results if (!empty($stickies)) { // Query to use in get_posts to get sticky posts $sticky_query = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => 'any', 'meta_key' => '_bbp_last_active_time', 'meta_type' => 'DATETIME', 'orderby' => 'meta_value', 'order' => 'DESC', 'include' => $stickies); // Cleanup unset($stickies); // Conditionally exclude private/hidden forum ID's $exclude_forum_ids = bbp_exclude_forum_ids('array'); if (!empty($exclude_forum_ids)) { $sticky_query['post_parent__not_in'] = $exclude_forum_ids; } // What are the default allowed statuses (based on user caps) if (bbp_get_view_all()) { $sticky_query['post_status'] = $r['post_status']; // Lean on the 'perm' query var value of 'readable' to provide statuses } else { $sticky_query['post_status'] = $r['perm']; } // Get all stickies $sticky_posts = get_posts($sticky_query); if (!empty($sticky_posts)) { // Get a count of the visible stickies $sticky_count = count($sticky_posts); // Merge the stickies topics with the query topics . $bbp->topic_query->posts = array_merge($sticky_posts, $bbp->topic_query->posts); // Adjust loop and counts for new sticky positions $bbp->topic_query->found_posts = (int) $bbp->topic_query->found_posts + (int) $sticky_count; $bbp->topic_query->post_count = (int) $bbp->topic_query->post_count + (int) $sticky_count; // Cleanup unset($sticky_posts); } } } } // If no limit to posts per page, set it to the current post_count if (-1 === $r['posts_per_page']) { $r['posts_per_page'] = $bbp->topic_query->post_count; } // Add pagination values to query object $bbp->topic_query->posts_per_page = $r['posts_per_page']; $bbp->topic_query->paged = $r['paged']; // Only add pagination if query returned results if (((int) $bbp->topic_query->post_count || (int) $bbp->topic_query->found_posts) && (int) $bbp->topic_query->posts_per_page) { // Limit the number of topics shown based on maximum allowed pages if (!empty($r['max_num_pages']) && $bbp->topic_query->found_posts > $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count) { $bbp->topic_query->found_posts = $bbp->topic_query->max_num_pages * $bbp->topic_query->post_count; } // If pretty permalinks are enabled, make our pagination pretty if (bbp_use_pretty_urls()) { // User's topics if (bbp_is_single_user_topics()) { $base = bbp_get_user_topics_created_url(bbp_get_displayed_user_id()); // User's favorites } elseif (bbp_is_favorites()) { $base = bbp_get_favorites_permalink(bbp_get_displayed_user_id()); // User's subscriptions } elseif (bbp_is_subscriptions()) { $base = bbp_get_subscriptions_permalink(bbp_get_displayed_user_id()); // Root profile page } elseif (bbp_is_single_user()) { $base = bbp_get_user_profile_url(bbp_get_displayed_user_id()); // View } elseif (bbp_is_single_view()) { $base = bbp_get_view_url(); // Topic tag } elseif (bbp_is_topic_tag()) { $base = bbp_get_topic_tag_link(); // Page or single post } elseif (is_page() || is_single()) { $base = get_permalink(); // Forum archive } elseif (bbp_is_forum_archive()) { $base = bbp_get_forums_url(); // Topic archive } elseif (bbp_is_topic_archive()) { $base = bbp_get_topics_url(); // Default } else { $base = get_permalink((int) $r['post_parent']); } // Use pagination base $base = trailingslashit($base) . user_trailingslashit(bbp_get_paged_slug() . '/%#%/'); // Unpretty pagination } else { $base = add_query_arg('paged', '%#%'); } // Pagination settings with filter $bbp_topic_pagination = apply_filters('bbp_topic_pagination', array('base' => $base, 'format' => '', 'total' => $r['posts_per_page'] === $bbp->topic_query->found_posts ? 1 : ceil((int) $bbp->topic_query->found_posts / (int) $r['posts_per_page']), 'current' => (int) $bbp->topic_query->paged, 'prev_text' => is_rtl() ? '→' : '←', 'next_text' => is_rtl() ? '←' : '→', 'mid_size' => 1)); // Add pagination to query object $bbp->topic_query->pagination_links = paginate_links($bbp_topic_pagination); // Remove first page from pagination $bbp->topic_query->pagination_links = str_replace(bbp_get_paged_slug() . "/1/'", "'", $bbp->topic_query->pagination_links); } // Return object return apply_filters('bbp_has_topics', $bbp->topic_query->have_posts(), $bbp->topic_query); }
/** * 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); }
<div class="<?php echo vibe_get_container(); ?> "> <div class="row"> <div class="col-md-9 col-sm-8"> <?php bbp_breadcrumb(); ?> <div class="pagetitle"> <h1><?php the_title(); ?> </h1> <?php if (bbp_is_forum_archive()) { _e('All Forums directory', 'vibe'); } if (bbp_is_single_forum()) { bbp_forum_subscription_link(); bbp_single_forum_description(); } if (bbp_is_single_topic()) { bbp_topic_tag_list(); bbp_single_topic_description(); } ?> </div> </div> <div class="col-md-3 col-sm-4">
/** * The main forum loop. * * WordPress makes this easy for us. * * @since bbPress (r2464) * * @param mixed $args All the arguments supported by {@link WP_Query} * @uses WP_Query To make query and get the forums * @uses bbp_get_forum_post_type() To get the forum post type id * @uses bbp_get_forum_id() To get the forum id * @uses get_option() To get the forums per page option * @uses current_user_can() To check if the current user is capable of editing * others' forums * @uses apply_filters() Calls 'bbp_has_forums' with * bbPres::forum_query::have_posts() * and bbPres::forum_query * @return object Multidimensional array of forum information */ function bbp_has_forums($args = '') { // Forum archive only shows root if (bbp_is_forum_archive()) { $default_post_parent = 0; // User subscriptions shows any } elseif (bbp_is_subscriptions()) { $default_post_parent = 'any'; // Could be anything, so look for possible parent ID } else { $default_post_parent = bbp_get_forum_id(); } // Parse arguments with default forum query for most circumstances $bbp_f = bbp_parse_args($args, array('post_type' => bbp_get_forum_post_type(), 'post_parent' => $default_post_parent, 'post_status' => bbp_get_public_status_id(), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'ignore_sticky_posts' => true, 'orderby' => 'menu_order title', 'order' => 'ASC'), 'has_forums'); // Run the query $bbp = bbpress(); $bbp->forum_query = new WP_Query($bbp_f); return apply_filters('bbp_has_forums', $bbp->forum_query->have_posts(), $bbp->forum_query); }