/** * Load Custom tabs on BuddyPress * * @global object $bp global BuddyPress object */ function custom_media_nav_tab() { global $bp; if (!function_exists("bp_core_new_nav_item")) { return; } if (bp_is_blog_page() || !bp_is_group() && !(isset($bp->displayed_user) && isset($bp->displayed_user->id)) || apply_filters('rtmedia_render_bp_nav', false)) { return; } global $rtmedia; if (function_exists("bp_is_group") && !bp_is_group()) { if (isset($bp->displayed_user) && isset($bp->displayed_user->id)) { $profile_counts = $this->actual_counts($bp->displayed_user->id); } $tab_position = apply_filters('rtmedia_media_tab_position', 99); if ($rtmedia->options["buddypress_enableOnProfile"] != 0) { bp_core_new_nav_item(array('name' => RTMEDIA_MEDIA_LABEL . '<span>' . $profile_counts['total']['all'] . '</span>', 'slug' => apply_filters('rtmedia_media_tab_slug', RTMEDIA_MEDIA_SLUG), 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all', 'position' => $tab_position)); } } if (bp_is_group() && $rtmedia->options["buddypress_enableOnGroup"] != 0) { global $bp; $media_enabled = true; //filter for rtMedia PRO for PER GROUP MEDIA enable/disable functionality $media_enabled = apply_filters('rtmedia_media_enabled_for_current_group', $media_enabled); // check if current user can view this group $current_group = groups_get_current_group(); $is_visible_to_current_user = $current_group->is_visible; if ($media_enabled && $is_visible_to_current_user) { $group_counts = $this->actual_counts($bp->groups->current_group->id, "group"); $bp->bp_options_nav[bp_get_current_group_slug()]['media'] = array('name' => RTMEDIA_MEDIA_LABEL . '<span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . RTMEDIA_MEDIA_SLUG, 'slug' => RTMEDIA_MEDIA_SLUG, 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all'); } } }
/** * */ function set_bp_context() { if (bp_is_blog_page() && !is_home()) { $this->set_wp_context(); } else { $this->set_bp_component_context(); } }
function wplms_remove_wpseo_from_buddypress() { if (function_exists('bp_is_blog_page')) { if (!bp_is_blog_page()) { global $wpseo_front; remove_filter('wp_title', array($wpseo_front, 'title'), 15); } } }
/** * Shows a breadcrumb for all types of pages. This is a wrapper function for the Breadcrumb_Trail class, * which should be used in theme templates. * * @since 0.1.0 * @access public * @param array $args Arguments to pass to Breadcrumb_Trail. * @return void */ function kleo_breadcrumb($args = array()) { if (function_exists('bp_is_active') && !bp_is_blog_page()) { $breadcrumb = new buddypress_Breadcrumb_Trail($args); } elseif (function_exists('is_bbpress') && is_bbpress()) { $breadcrumb = new bbPress_Breadcrumb_Trail($args); } else { $breadcrumb = new Breadcrumb_Trail($args); } return $breadcrumb->trail(); }
/** * Load Custom tabs on BuddyPress * * @global object $bp global BuddyPress object */ function custom_media_nav_tab() { $bp = buddypress(); if (!function_exists('bp_core_new_nav_item')) { return; } if (bp_is_blog_page() || !bp_is_group() && !(isset($bp->displayed_user) && isset($bp->displayed_user->id)) || apply_filters('rtmedia_render_bp_nav', false)) { return; } global $rtmedia; if (function_exists('bp_is_group') && !bp_is_group()) { if (isset($bp->displayed_user) && isset($bp->displayed_user->id)) { $profile_counts = $this->actual_counts($bp->displayed_user->id); } $tab_position = apply_filters('rtmedia_media_tab_position', 99); if (0 !== intval($rtmedia->options['buddypress_enableOnProfile'])) { bp_core_new_nav_item(array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $profile_counts['total']['all'] . '</span>', 'slug' => apply_filters('rtmedia_media_tab_slug', RTMEDIA_MEDIA_SLUG), 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all', 'position' => $tab_position)); } } if (bp_is_group() && 0 !== intval($rtmedia->options['buddypress_enableOnGroup'])) { $media_enabled = true; //filter for rtMedia PRO for PER GROUP MEDIA enable/disable functionality $media_enabled = apply_filters('rtmedia_media_enabled_for_current_group', $media_enabled); // check if current user can view this group $current_group = groups_get_current_group(); /** * remove `$current_group->is_visible` and add `bp_group_is_visible( $current_group )` * reason : In Buddypress 2.7 `is_visible` return false so we can't display `media` tab on group * issue id : http://git.rtcamp.com/rtmedia/rtMedia/issues/119 */ // $is_visible_to_current_user = $current_group->is_visible; $is_visible_to_current_user = bp_group_is_visible($current_group); if ($media_enabled && $is_visible_to_current_user) { $group_counts = $this->actual_counts($bp->groups->current_group->id, 'group'); $slug = apply_filters('rtmedia_group_media_tab_slug', RTMEDIA_MEDIA_SLUG); if (isset($bp->version) && $bp->version > '2.5.3') { /* * As from BuddyPress 2.6, you can't access $bp->bp_options_nav directly. * Use `bp_core_new_subnav_item` to add subnav item. * * Check https://buddypress.trac.wordpress.org/ticket/6534 and https://buddypress.trac.wordpress.org/changeset/10745 * for more details */ bp_core_new_subnav_item(array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . $slug, 'slug' => $slug, 'parent_slug' => bp_get_current_group_slug(), 'parent_url' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/'), 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all')); } else { $bp->bp_options_nav[bp_get_current_group_slug()]['media'] = array('name' => RTMEDIA_MEDIA_LABEL . ' <span>' . $group_counts['total']['all'] . '</span>', 'link' => trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_current_group_slug() . '/') . $slug, 'slug' => $slug, 'user_has_access' => true, 'css_id' => 'rtmedia-media-nav', 'position' => 99, 'screen_function' => array($this, 'media_screen'), 'default_subnav_slug' => 'all'); } } } }
/** * Include Javascript */ public function load_js() { $template_uri = get_template_directory_uri(); //yu read it right, bp-default theme js wp_enqueue_script('dtheme-uniform-js', $template_uri . '/_inc/js/jquery.uniform.min.js', array('jquery'), bp_get_version()); wp_enqueue_script('enhance-js', $template_uri . '/_inc/js/enhance.js', array('jquery', 'dtheme-uniform-js'), bp_get_version()); // Enqueue the global JS - Ajax will not work without it wp_enqueue_script('dtheme-ajax-js', $template_uri . '/_inc/js/global.js', array('jquery'), bp_get_version()); // Add words that we need to use in JS to the end of the page so they can be translated and still used. $params = array('my_favs' => __('My Favorites', 'bp-magic'), 'accepted' => __('Accepted', 'bp-magic'), 'rejected' => __('Rejected', 'bp-magic'), 'show_all_comments' => __('Show all comments for this thread', 'bp-magic'), 'show_all' => __('Show all', 'bp-magic'), 'comments' => __('comments', 'bp-magic'), 'close' => __('Close', 'bp-magic'), 'view' => __('View', 'bp-magic'), 'mark_as_fav' => __('Favorite', 'bp-magic'), 'remove_fav' => __('Remove Favorite', 'bp-magic')); wp_localize_script('dtheme-ajax-js', 'BP_DTheme', $params); // Maybe enqueue comment reply JS if (is_singular() && bp_is_blog_page() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
/** * Unhook the NXTClass core menus. * * @since BuddyPress (r4151) * * @uses remove_action * @uses is_network_admin() * @uses is_user_admin() */ function bp_admin_bar_remove_nxt_menus() { if ('3.2' == bp_get_major_nxt_version()) { remove_action('admin_bar_menu', 'nxt_admin_bar_my_account_menu', 10); remove_action('admin_bar_menu', 'nxt_admin_bar_my_sites_menu', 20); remove_action('admin_bar_menu', 'nxt_admin_bar_dashboard_view_site_menu', 25); // Don't show the 'Edit Page' menu on BP pages if (!bp_is_blog_page()) { remove_action('admin_bar_menu', 'nxt_admin_bar_edit_menu', 30); } remove_action('admin_bar_menu', 'nxt_admin_bar_shortlink_menu', 80); remove_action('admin_bar_menu', 'nxt_admin_bar_updates_menu', 70); if (!is_network_admin() && !is_user_admin()) { remove_action('admin_bar_menu', 'nxt_admin_bar_comments_menu', 50); remove_action('admin_bar_menu', 'nxt_admin_bar_appearance_menu', 60); } remove_action('admin_bar_menu', 'nxt_admin_bar_updates_menu', 70); } }
/** * Check user access and redirect if access denied */ public function maybe_redirect() { // always allow access to blog, registration and activation pages if (bp_is_blog_page() || bp_is_register_page() || bp_is_activation_page()) { return; } // grab toggle option from registry $opt_toggle = $this->get_suboption('toggle'); // is option toggled on? if ($opt_toggle && true == $opt_toggle->get()) { // protection is enabled, is user logged in? if (!is_user_logged_in()) { // not logged in, redirect to registration page bp_core_redirect(bp_get_root_domain() . '/' . bp_get_root_slug('register')); // exit to avoid any accidental output exit; } } }
/** * Enqueues CSS files. * * @since 2.0 * @global object $bp BuddyPress global settings */ function dpa_add_css() { global $bp; if (is_active_widget(false, false, 'achievements-sitewide') || is_active_widget(false, false, 'achievements-available-achievements') || is_active_widget(false, false, 'achievements-member-achievements') || is_active_widget(false, false, 'achievements-featured-achievement') || is_active_widget(false, false, 'achievements-member-achievements-available') || is_active_widget(false, false, 'achievements-member-points')) { nxt_enqueue_style('achievements-widget', plugins_url('/css/widget.css', __FILE__), array(), ACHIEVEMENTS_VERSION); } if (!bp_is_current_component($bp->achievements->slug)) { if (bp_is_active('activity') && bp_is_activity_component() && !bp_is_blog_page() || bp_is_component_front_page('activity') && bp_is_front_page()) { nxt_enqueue_style('achievements-directory', plugins_url('/css/directory.css', __FILE__), array(), ACHIEVEMENTS_VERSION); } nxt_print_styles(); return; } if (DPA_SLUG_CREATE == $bp->current_action && dpa_permission_can_user_create() || DPA_SLUG_ACHIEVEMENT_EDIT == $bp->current_action && dpa_permission_can_user_edit() || DPA_SLUG_ACHIEVEMENT_CHANGE_PICTURE == $bp->current_action && dpa_permission_can_user_change_picture() || DPA_SLUG_ACHIEVEMENT_GRANT == $bp->current_action && dpa_permission_can_user_grant()) { nxt_enqueue_style('achievements-admin', plugins_url('/css/admin.css', __FILE__), array(), ACHIEVEMENTS_VERSION); } if ($bp->is_single_item) { nxt_enqueue_style('achievements-detail', plugins_url('/css/detail.css', __FILE__), array(), ACHIEVEMENTS_VERSION); } else { nxt_enqueue_style('achievements-directory', plugins_url('/css/directory.css', __FILE__), array(), ACHIEVEMENTS_VERSION); } nxt_print_styles(); }
wp_title('|', true, 'right'); bloginfo('name'); ?> </title> <?php do_action('bp_head'); ?> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?> " /> <?php if (is_singular() && bp_is_blog_page() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_head(); ?> </head> <body <?php body_class(); ?> id="bp-default"> <?php do_action('bp_before_header'); ?>
/** * Remove WP's rel=canonical HTML tag if we are trying to load BP-specific content. * * This function should be considered temporary, and may be removed without * notice in future versions of BuddyPress. * * @since 1.6.0 */ function _bp_maybe_remove_rel_canonical() { if (!bp_is_blog_page() && !is_404()) { remove_action('wp_head', 'rel_canonical'); add_action('bp_head', 'bp_rel_canonical'); } }
/** * In BuddyPress 1.2.x, this added the javascript needed for blog comment replies. * As of 1.5.x, we recommend that you enqueue the comment-reply javascript in your theme's header.php. * * @deprecated 1.5 * @deprecated Enqueue the comment-reply script in your theme's header.php. * @since 1.2 */ function bp_dtheme_add_blog_comments_js() { _deprecated_function(__FUNCTION__, '1.5', "Enqueue the comment-reply script in your theme's header.php."); if (is_singular() && bp_is_blog_page() && get_option('thread_comments')) { nxt_enqueue_script('comment-reply'); } }
/** * Should BuddyPress load the mentions scripts and related assets, including results to prime the * mentions suggestions? * * @param bool $load_mentions True to load mentions assets, false otherwise. * @param bool $mentions_enabled True if mentions are enabled. * @return bool True if mentions scripts should be loaded. * @since BuddyPress (2.2.0) */ function bp_maybe_load_mentions_scripts_for_blog_content( $load_mentions, $mentions_enabled ) { if ( ! $mentions_enabled ) { return $load_mentions; } if ( $load_mentions || ( bp_is_blog_page() && is_singular() && comments_open() ) ) { return true; } return $load_mentions; }
/** * Should BuddyPress load the mentions scripts and related assets, including results to prime the * mentions suggestions? * * @return bool True if mentions scripts should be loaded. * @since BuddyPress (2.1.0) */ function bp_activity_maybe_load_mentions_scripts() { $retval = bp_activity_do_mentions() && bp_is_user_active() && (bp_is_activity_component() || bp_is_blog_page() && is_singular() && comments_open() || is_admin()); return (bool) apply_filters('bp_activity_maybe_load_mentions_scripts', $retval); }
/** * Catches invalid access to BuddyPress pages and redirects them accordingly. * * @package BuddyPress Core * @since 1.5 */ function bp_core_catch_no_access() { global $bp, $bp_no_status_set, $nxt_query; // If bp_core_redirect() and $bp_no_status_set is true, // we are redirecting to an accessible page, so skip this check. if ($bp_no_status_set) { return false; } if (!isset($nxt_query->queried_object) && !bp_is_blog_page()) { bp_do_404(); } }
?> <div class="container-wrap"> <div class="container main-content"> <div class="row"> <?php //breadcrumbs if (function_exists('yoast_breadcrumb') && !is_home() && !is_front_page()) { yoast_breadcrumb('<p id="breadcrumbs">', '</p>'); } //buddypress global $bp; if ($bp && !bp_is_blog_page()) { echo '<h1>' . get_the_title() . '</h1>'; } ?> <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <?php the_content(); ?> <?php
/** * Whether to show the blog footer buttons. * * @return bool Defaults to true. False when on BP root blog and not on a blog * page deemed by BuddyPress. */ public static function show_footer_button() { $retval = true; // @todo might need to tweak this a bit... if (bp_is_root_blog() && !bp_is_blog_page()) { $retval = false; } return apply_filters('bp_follow_blogs_show_footer_button', $retval); }
/** * Enqueue the required JavaScript files * * @since BuddyPress (1.7) */ public function enqueue_scripts() { $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // Locate the BP JS file $asset = $this->locate_asset_in_stack("buddypress{$min}.js", 'js'); // Enqueue the global JS, if found - AJAX will not work // without it if (isset($asset['location'], $asset['handle'])) { wp_enqueue_script($asset['handle'], $asset['location'], bp_core_get_js_dependencies(), $this->version); } /** * Filters core JavaScript strings for internationalization before AJAX usage. * * @since BuddyPress (2.0.0) * * @param array $value Array of key/value pairs for AJAX usage. */ $params = apply_filters('bp_core_get_js_strings', array('accepted' => __('Accepted', 'buddypress'), 'close' => __('Close', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'leave_group_confirm' => __('Are you sure you want to leave this group?', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'my_favs' => __('My Favorites', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_x_comments' => __('Show all %d comments', 'buddypress'), 'unsaved_changes' => __('Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress'), 'view' => __('View', 'buddypress'))); wp_localize_script($asset['handle'], 'BP_DTheme', $params); // Maybe enqueue comment reply JS if (is_singular() && bp_is_blog_page() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } // Maybe enqueue password verify JS (register page or user settings page) if (bp_is_register_page() || function_exists('bp_is_user_settings_general') && bp_is_user_settings_general()) { // Locate the Register Page JS file $asset = $this->locate_asset_in_stack("password-verify{$min}.js", 'js', 'bp-legacy-password-verify'); $dependencies = array_merge(bp_core_get_js_dependencies(), array('password-strength-meter')); // Enqueue script wp_enqueue_script($asset['handle'] . '-password-verify', $asset['location'], $dependencies, $this->version); } // Star private messages if (bp_is_active('messages', 'star') && bp_is_user_messages()) { wp_localize_script($asset['handle'], 'BP_PM_Star', array('strings' => array('text_unstar' => __('Unstar', 'buddypress'), 'text_star' => __('Star', 'buddypress'), 'title_unstar' => __('Starred', 'buddypress'), 'title_star' => __('Not starred', 'buddypress'), 'title_unstar_thread' => __('Remove all starred messages in this thread', 'buddypress'), 'title_star_thread' => __('Star the first message in this thread', 'buddypress')), 'is_single_thread' => (int) bp_is_messages_conversation(), 'star_counter' => 0, 'unstar_counter' => 0)); } }
/** * Enqueue theme javascript safely * * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_script * @since BuddyPress (1.5) */ function bp_dtheme_enqueue_scripts() { // Enqueue various scripts wp_enqueue_script('bp-jquery-query'); wp_enqueue_script('bp-jquery-cookie'); // Enqueue scrollTo only on activity pages if (bp_is_activity_component()) { wp_enqueue_script('bp-jquery-scroll-to'); } // A similar check is done in BP_Core_Members_Widget, but due to a load order // issue, we do it again here if (is_active_widget(false, false, 'bp_core_members_widget') && !is_admin() && !is_network_admin()) { wp_enqueue_script('bp-widget-members'); } // Enqueue the global JS - Ajax will not work without it wp_enqueue_script('dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array('jquery'), bp_get_version()); // Add words that we need to use in JS to the end of the page so they can be translated and still used. $params = array('my_favs' => __('My Favorites', 'buddypress'), 'accepted' => __('Accepted', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_x_comments' => __('Show all %d comments', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'close' => __('Close', 'buddypress'), 'view' => __('View', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress'), 'unsaved_changes' => __('Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress')); wp_localize_script('dtheme-ajax-js', 'BP_DTheme', $params); // Maybe enqueue comment reply JS if (is_singular() && bp_is_blog_page() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
/** dttheme_public_title() * Objective: * Outputs the value for <title></title> in front end. * **/ function dttheme_public_title() { global $post; $doctitle = ''; $separator = dttheme_wp_kses(dttheme_option('seo', 'title-delimiter')); $split = true; $args = array("blog_title" => preg_replace("~(?:\\[/?)[^/\\]]+/?\\]~s", '', get_option('blogname')), "blog_description" => get_bloginfo('description'), "post_title" => !empty($post) ? $post->post_title : NULL, "post_author_nicename" => !empty($nickname) ? ucwords($nickname) : NULL, "post_author_firstname" => !empty($first_name) ? ucwords($first_name) : NULL, "post_author_lastname" => !empty($last_name) ? ucwords($last_name) : NULL, "post_author_dsiplay" => !empty($display_name) ? ucwords($display_name) : NULL); $args = array_filter($args); if (class_exists('BP_Core_user') && !bp_is_blog_page()) { $doctitle = dt_theme_bbpress_title(); } elseif (function_exists('is_bbpress') && is_bbpress()) { $doctitle = dt_theme_bbpress_title(); } elseif (is_home() || is_front_page()) { $doctitle = ""; if (get_option('page_on_front') != 0 && get_option('page_on_front') == $post->ID) { $doctitle = trim(get_post_meta($post->ID, '_seo_title', true)); } $doctitle = !empty($doctitle) ? trim($doctitle) : $args["blog_title"]; $doctitle = array_key_exists("blog_description", $args) ? $doctitle . ' ' . $separator . ' ' . $args["blog_description"] : $doctitle; if (dttheme_option('onepage', 'seo-title')) { $doctitle = dttheme_option('onepage', 'seo-title'); } $split = false; } elseif (is_page()) { $doctitle = get_post_meta($post->ID, '_seo_title', true); if (empty($doctitle)) { $options = is_array(dttheme_option('seo', 'page-title-format')) ? dttheme_option('seo', 'page-title-format') : array(); foreach ($options as $option) { if (array_key_exists($option, $args)) { $doctitle .= $args[$option] . ' ' . $separator . ' '; } } } } elseif (is_single()) { $doctitle = get_post_meta($post->ID, '_seo_title', true); if (empty($doctitle)) { // o add categories in $args $categories = get_the_category(); $c = ''; foreach ($categories as $category) { $c .= $category->name . ' ' . $separator . ' '; } $c = substr(trim($c), "0", strlen(trim($c)) - 1); $args["category_title"] = $c; // nd of adding categories in $args // o add tags in $args $posttags = get_the_tags(); $ptags = ''; if ($posttags) { foreach ($posttags as $posttag) { $ptags .= $posttag->name . $separator; } $ptags = substr(trim($ptags), "0", strlen(trim($ptags)) - 1); $args["tag_title"] = $ptags; } // nd of adding tags in $args $options = is_array(dttheme_option('seo', 'post-title-format')) ? dttheme_option('seo', 'post-title-format') : array(); foreach ($options as $option) { if (array_key_exists($option, $args)) { $doctitle .= $args[$option] . ' ' . $separator . ' '; } } } } elseif (is_category()) { $categories = get_the_category(); // o add category description into $args $args["category_title"] = $categories[0]->name; $args["category_desc"] = $categories[0]->description; // nd of adding category description into $args $options = is_array(dttheme_option('seo', 'category-page-title-format')) ? dttheme_option('seo', 'category-page-title-format') : array(); foreach ($options as $option) { if (array_key_exists($option, $args)) { $doctitle .= $args[$option] . ' ' . $separator . ' '; } } } elseif (is_tag()) { $args["tag"] = single_tag_title('', FALSE); $options = is_array(dttheme_option('seo', 'tag-page-title-format')) ? dttheme_option('seo', 'tag-page-title-format') : array(); foreach ($options as $option) { if (array_key_exists($option, $args)) { $doctitle .= $args[$option] . ' ' . $separator . ' '; } } } elseif (is_archive()) { $title = wp_title(" ", false); $find = $args['blog_title']; $title = preg_replace(strrev("/{$find}/"), strrev(""), strrev($title), 1); $title = strrev($title); $args["date"] = $title; $options = is_array(dttheme_option('seo', 'archive-page-title-format')) ? dttheme_option('seo', 'archive-page-title-format') : array(); foreach ($options as $option) { if (array_key_exists($option, $args)) { $doctitle .= $args[$option] . ' ' . $separator . ' '; } } } elseif (is_date()) { } elseif (is_search()) { $args["search"] = __("Search results for", 'dt_themes') . ' "' . $_REQUEST['s'] . '"'; // dding search text into the default args $options = is_array(dttheme_option('seo', 'search-page-title-format')) ? dttheme_option('seo', 'search-page-title-format') : array(); foreach ($options as $option) { if (array_key_exists($option, $args)) { $doctitle .= $args[$option] . ' ' . $separator . ' '; } } } elseif (is_404()) { $options = is_array(dttheme_option('seo', '404-page-title-format')) ? dttheme_option('seo', '404-page-title-format') : array(); foreach ($options as $option) { if (array_key_exists($option, $args)) { $doctitle .= $args[$option] . ' ' . $separator . ' '; } } $doctitle = $doctitle . __('Page not found', 'dt_themes'); $split = false; } if ($split) { if (strrpos($doctitle, $separator)) { $doctitle = str_split($doctitle, strrpos($doctitle, $separator)); $doctitle = $doctitle[0]; } } return $doctitle; }
public function remove_wpml_post_availability_hook() { if (!bp_is_blog_page()) { global $icl_language_switcher; remove_filter('the_content', array($icl_language_switcher, 'post_availability'), 100); } }
/** * 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); }
function add_upload_button() { if (function_exists('bp_is_blog_page') && !bp_is_blog_page()) { if (function_exists('bp_is_user') && bp_is_user() && function_exists('bp_displayed_user_id') && bp_displayed_user_id() == get_current_user_id()) { echo '<span class="primary rtmedia-upload-media-link" id="rtm_show_upload_ui" title="' . __('Upload Media', 'rtmedia') . '"><i class="dashicons dashicons-upload rtmicon"></i>' . __('Upload', 'rtmedia') . '</span>'; } else { if (function_exists('bp_is_group') && bp_is_group()) { if (can_user_upload_in_group()) { echo '<span class="rtmedia-upload-media-link primary" id="rtm_show_upload_ui" title="' . __('Upload Media', 'rtmedia') . '"><i class="dashicons dashicons-upload rtmicon"></i>' . __('Upload', 'rtmedia') . '</span>'; } } } } }
<?php include TEMPLATEPATH . '/lib/includes/options.php'; ?> <?php if ($bp_existed == 'true') { //check if bp existed ?> <?php if (bp_is_blog_page()) { ?> <div id="sidebar"> <ul class="list"> <?php if (is_active_sidebar('sidebar')) { dynamic_sidebar('sidebar'); } else { ?> <li> <h3><?php // _e('Sidebar Widget', TEMPLATE_DOMAIN); ?> </h3> <ul> <li><?php // printf(__('All you need to do is to visit your <a href="%s/widgets.php">widget</a> tab replace this with your widget', TEMPLATE_DOMAIN), admin_url()); ?> </li>
function bp_page_title() { global $bp, $post, $wp_query; if (is_home() && bp_is_page('home')) { $title = __('Home', 'buddypress'); } else { if (bp_is_blog_page()) { if (is_single()) { $title = __('Blog — ' . $post->post_title, 'buddypress'); } else { if (is_category()) { $title = __('Blog — Categories — ' . ucwords($wp_query->query_vars['category_name']), 'buddypress'); } else { if (is_tag()) { $title = __('Blog — Tags — ' . ucwords($wp_query->query_vars['tag']), 'buddypress'); } else { $title = __('Blog', 'buddypress'); } } } } else { if (!empty($bp->displayed_user->fullname)) { $title = strip_tags($bp->displayed_user->fullname . ' — ' . ucwords($bp->current_component) . ' — ' . $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name']); } else { if ($bp->is_single_item) { $title = ucwords($bp->current_component) . ' — ' . $bp->bp_options_title; } else { if ($bp->is_directory) { if (!$bp->current_component) { $title = sprintf(__('%s Directory', 'buddypress'), ucwords(BP_MEMBERS_SLUG)); } else { $title = sprintf(__('%s Directory', 'buddypress'), ucwords($bp->current_component)); } } else { global $post; $title = get_the_title($post->ID); } } } } } echo apply_filters('bp_page_title', get_blog_option(BP_ROOT_BLOG, 'blogname') . ' — ' . attribute_escape($title), attribute_escape($title)); }
/** * Customize the body class, according to the currently displayed BP content. * * Uses the above is_() functions to output a body class for each scenario. * * @since 1.1.0 * * @param array $wp_classes The body classes coming from WP. * @param array|bool $custom_classes Classes that were passed to get_body_class(). * @return array $classes The BP-adjusted body classes. */ function bp_get_the_body_class($wp_classes = array(), $custom_classes = false) { $bp_classes = array(); /* Pages *************************************************************/ if (is_front_page()) { $bp_classes[] = 'home-page'; } if (bp_is_directory()) { $bp_classes[] = 'directory'; } if (bp_is_single_item()) { $bp_classes[] = 'single-item'; } /* Components ********************************************************/ if (!bp_is_blog_page()) { if (bp_is_user_profile()) { $bp_classes[] = 'xprofile'; } if (bp_is_activity_component()) { $bp_classes[] = 'activity'; } if (bp_is_blogs_component()) { $bp_classes[] = 'blogs'; } if (bp_is_messages_component()) { $bp_classes[] = 'messages'; } if (bp_is_friends_component()) { $bp_classes[] = 'friends'; } if (bp_is_groups_component()) { $bp_classes[] = 'groups'; } if (bp_is_settings_component()) { $bp_classes[] = 'settings'; } } /* User **************************************************************/ if (bp_is_user()) { $bp_classes[] = 'bp-user'; // Add current user member types. if ($member_types = bp_get_member_type(bp_displayed_user_id(), false)) { foreach ($member_types as $member_type) { $bp_classes[] = sprintf('member-type-%s', esc_attr($member_type)); } } } if (!bp_is_directory()) { if (bp_is_user_blogs()) { $bp_classes[] = 'my-blogs'; } if (bp_is_user_groups()) { $bp_classes[] = 'my-groups'; } if (bp_is_user_activity()) { $bp_classes[] = 'my-activity'; } } else { if (bp_get_current_member_type()) { $bp_classes[] = 'type'; } } if (bp_is_my_profile()) { $bp_classes[] = 'my-account'; } if (bp_is_user_profile()) { $bp_classes[] = 'my-profile'; } if (bp_is_user_friends()) { $bp_classes[] = 'my-friends'; } if (bp_is_user_messages()) { $bp_classes[] = 'my-messages'; } if (bp_is_user_recent_commments()) { $bp_classes[] = 'recent-comments'; } if (bp_is_user_recent_posts()) { $bp_classes[] = 'recent-posts'; } if (bp_is_user_change_avatar()) { $bp_classes[] = 'change-avatar'; } if (bp_is_user_profile_edit()) { $bp_classes[] = 'profile-edit'; } if (bp_is_user_friends_activity()) { $bp_classes[] = 'friends-activity'; } if (bp_is_user_groups_activity()) { $bp_classes[] = 'groups-activity'; } /* Messages **********************************************************/ if (bp_is_messages_inbox()) { $bp_classes[] = 'inbox'; } if (bp_is_messages_sentbox()) { $bp_classes[] = 'sentbox'; } if (bp_is_messages_compose_screen()) { $bp_classes[] = 'compose'; } if (bp_is_notices()) { $bp_classes[] = 'notices'; } if (bp_is_user_friend_requests()) { $bp_classes[] = 'friend-requests'; } if (bp_is_create_blog()) { $bp_classes[] = 'create-blog'; } /* Groups ************************************************************/ if (bp_is_group()) { $bp_classes[] = 'group-' . groups_get_current_group()->slug; // Add current group types. if ($group_types = bp_groups_get_group_type(bp_get_current_group_id(), false)) { foreach ($group_types as $group_type) { $bp_classes[] = sprintf('group-type-%s', esc_attr($group_type)); } } } if (bp_is_group_leave()) { $bp_classes[] = 'leave-group'; } if (bp_is_group_invites()) { $bp_classes[] = 'group-invites'; } if (bp_is_group_members()) { $bp_classes[] = 'group-members'; } if (bp_is_group_forum_topic()) { $bp_classes[] = 'group-forum-topic'; } if (bp_is_group_forum_topic_edit()) { $bp_classes[] = 'group-forum-topic-edit'; } if (bp_is_group_forum()) { $bp_classes[] = 'group-forum'; } if (bp_is_group_admin_page()) { $bp_classes[] = 'group-admin'; $bp_classes[] = bp_get_group_current_admin_tab(); } if (bp_is_group_create()) { $bp_classes[] = 'group-create'; $bp_classes[] = bp_get_groups_current_create_step(); } if (bp_is_group_home()) { $bp_classes[] = 'group-home'; } if (bp_is_single_activity()) { $bp_classes[] = 'activity-permalink'; } /* Registration ******************************************************/ if (bp_is_register_page()) { $bp_classes[] = 'registration'; } if (bp_is_activation_page()) { $bp_classes[] = 'activation'; } /* Current Component & Action ****************************************/ if (!bp_is_blog_page()) { $bp_classes[] = bp_current_component(); $bp_classes[] = bp_current_action(); } /* Clean up ***********************************************************/ // Add BuddyPress class if we are within a BuddyPress page. if (!bp_is_blog_page()) { $bp_classes[] = 'buddypress'; } // Merge WP classes with BuddyPress classes and remove any duplicates. $classes = array_unique(array_merge((array) $bp_classes, (array) $wp_classes)); /** * Filters the BuddyPress classes to be added to body_class() * * @since 1.1.0 * * @param array $classes Array of body classes to add. * @param array $bp_classes Array of BuddyPress-based classes. * @param array $wp_classes Array of WordPress-based classes. * @param array $custom_classes Array of classes that were passed to get_body_class(). */ return apply_filters('bp_get_the_body_class', $classes, $bp_classes, $wp_classes, $custom_classes); }
function rabp_genesis_is_blog_page() { return bp_is_blog_page(); }
* *************************************** */ // by default it is not an ajax request global $rt_ajax_request; $rt_ajax_request = false; // check if it is an ajax request if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $rt_ajax_request = true; } ?> <div id="buddypress"> <?php //if it's not an ajax request, load headers if (!$rt_ajax_request) { // if this is a BuddyPress page, set template type to // buddypress to load appropriate headers if (class_exists('BuddyPress') && !bp_is_blog_page()) { $template_type = 'buddypress'; } else { $template_type = ''; } //get_header( $template_type ); if ($template_type == 'buddypress') { //load buddypress markup if (bp_displayed_user_id()) { //if it is a buddypress member profile ?> <div id="item-header"> <?php bp_get_template_part('members/single/member-header'); ?>
function wds_canonical() { global $wds_options; global $wp_query, $paged; if (function_exists('bp_is_blog_page') && !(bp_is_blog_page() || is_404())) { return false; } // Set decent canonicals for homepage, singulars and taxonomy pages if (wds_get_value('canonical') && wds_get_value('canonical') != '') { echo "\t" . '<link rel="canonical" href="' . wds_get_value('canonical') . '" />' . "\n"; } else { if (is_singular()) { echo "\t"; rel_canonical(); } else { $canonical = ''; if (is_front_page()) { $canonical = trailingslashit(get_bloginfo('url')); } else { if (is_tax() || is_tag() || is_category()) { $term = $wp_query->get_queried_object(); $canonical = wds_get_term_meta($term, $term->taxonomy, 'wds_canonical'); $canonical = $canonical ? $canonical : get_term_link($term, $term->taxonomy); } else { if (is_date()) { $requested_year = get_query_var('year'); $requested_month = get_query_var('monthnum'); $date_callback = !empty($requested_year) && empty($requested_month) ? 'get_year_link' : 'get_month_link'; $canonical = $date_callback($requested_year, $requested_month); } } } //only show id not error object if ($canonical && !is_wp_error($canonical)) { if ($paged && !is_wp_error($paged)) { $canonical .= trailingslashit('page/' . $paged); } echo "\t" . '<link rel="canonical" href="' . $canonical . '" />' . "\n"; } } } }
/** * Enqueue the required Javascript files * * @since BuddyPress (1.7) */ public function enqueue_scripts() { $file = 'buddypress.js'; // Locate the BP JS file $asset = $this->locate_asset_in_stack($file, 'js'); // Enqueue the global JS, if found - AJAX will not work // without it if (isset($asset['location'], $asset['handle'])) { wp_enqueue_script($asset['handle'], $asset['location'], bp_core_get_js_dependencies(), $this->version); } // Add words that we need to use in JS to the end of the page // so they can be translated and still used. $params = apply_filters('bp_core_get_js_strings', array('accepted' => __('Accepted', 'buddypress'), 'close' => __('Close', 'buddypress'), 'comments' => __('comments', 'buddypress'), 'leave_group_confirm' => __('Are you sure you want to leave this group?', 'buddypress'), 'mark_as_fav' => __('Favorite', 'buddypress'), 'my_favs' => __('My Favorites', 'buddypress'), 'rejected' => __('Rejected', 'buddypress'), 'remove_fav' => __('Remove Favorite', 'buddypress'), 'show_all' => __('Show all', 'buddypress'), 'show_all_comments' => __('Show all comments for this thread', 'buddypress'), 'show_x_comments' => __('Show all %d comments', 'buddypress'), 'unsaved_changes' => __('Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress'), 'view' => __('View', 'buddypress'))); wp_localize_script($asset['handle'], 'BP_DTheme', $params); // Maybe enqueue comment reply JS if (is_singular() && bp_is_blog_page() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }