Ejemplo n.º 1
0
/**
 * Displays the user page title.
 *
 * @since  1.0.0
 * @access public
 * @return void
 */
function mb_user_page_title()
{
    echo mb_get_user_page_title();
}
 /**
  * Overwrites the `do_trail_items()` method and creates custom trail items.
  *
  * @since  1.0.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();
     $this->mb_do_board_home_link();
     /* Single forum, topic, or reply. */
     if (mb_is_single_forum() || mb_is_single_topic() || mb_is_single_reply()) {
         $this->do_singular_items();
     } elseif (mb_is_forum_archive() || mb_is_topic_archive() || mb_is_reply_archive()) {
         $this->do_post_type_archive_items();
     } elseif (mb_is_role_archive()) {
         $this->mb_do_user_archive_link();
         if (is_paged()) {
             $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_role_archive_url(), mb_get_role_archive_title());
         } elseif ($this->args['show_title']) {
             $this->items[] = mb_get_role_archive_title();
         }
     } elseif (mb_is_single_role()) {
         $this->mb_do_user_archive_link();
         $this->mb_do_role_archive_link();
         if (is_paged()) {
             $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_role_url(), mb_get_single_role_title());
         } elseif ($this->args['show_title']) {
             $this->items[] = mb_get_single_role_title();
         }
     } elseif (mb_is_user_archive()) {
         if (is_paged()) {
             $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_user_archive_url(), mb_get_user_archive_title());
         } elseif ($this->args['show_title']) {
             $this->items[] = mb_get_user_archive_title();
         }
     } elseif (mb_is_single_user()) {
         $this->mb_do_user_archive_link();
         /* If single user subpage. */
         if (mb_is_user_page()) {
             $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_user_url(), get_the_author_meta('display_name', mb_get_user_id()));
             if (is_paged()) {
                 if (mb_is_user_forums()) {
                     $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_user_forums_url(), mb_get_user_forums_title());
                 } elseif (mb_is_user_topics()) {
                     $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_user_topics_url(), mb_get_user_topics_title());
                 } elseif (mb_is_user_replies()) {
                     $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_user_replies_url(), mb_get_user_replies_title());
                 } elseif (mb_is_user_bookmarks()) {
                     $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_user_bookmarks_url(), mb_get_user_bookmarks_title());
                 } elseif (mb_is_user_forum_subscriptions()) {
                     $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_user_forum_subscriptions_url(), mb_get_user_forum_subscriptions_title());
                 } elseif (mb_is_user_topic_subscriptions()) {
                     $this->items[] = sprintf('<a href="%s">%s</a>', mb_get_user_topic_subscriptions_url(), mb_get_user_topic_subscriptions_title());
                 }
             } elseif ($this->args['show_title']) {
                 $this->items[] = mb_get_user_page_title();
             }
             /* If viewing the single user page but not a subpage. */
         } elseif ($this->args['show_title']) {
             $this->items[] = mb_get_single_user_title();
         }
         /* Login page. */
     } elseif (mb_is_forum_login()) {
         $this->items[] = mb_get_login_page_title();
     }
     /* Add paged items. */
     $this->do_paged_items();
     /* Return the board breadcrumb trail items. */
     $this->items = apply_filters('mb_get_breadcrumb_trail_items', $this->items, $this->args);
 }
Ejemplo n.º 3
0
/**
 * Filters `wp_title` to handle the title on the forum front page since this is a non-standard WP page.
 *
 * @since  1.0.0
 * @access public
 * @param  string  $title
 * @return string
 */
function mb_wp_title($title)
{
    if (!mb_is_message_board()) {
        return $title;
    }
    if (mb_is_single_forum()) {
        $title = mb_get_single_forum_title();
    } elseif (mb_is_forum_archive()) {
        $title = mb_get_forum_archive_title();
    } elseif (mb_is_single_topic()) {
        $title = mb_get_single_topic_title();
    } elseif (mb_is_topic_archive()) {
        $title = mb_get_topic_archive_title();
    } elseif (mb_is_single_reply()) {
        $title = mb_get_single_reply_title();
    } elseif (mb_is_reply_archive()) {
        $title = mb_get_reply_archive_title();
    } elseif (mb_is_single_role()) {
        $title = mb_get_single_role_title();
    } elseif (mb_is_role_archive()) {
        $title = mb_get_role_archive_title();
    } elseif (mb_is_user_page()) {
        $title = mb_get_user_page_title();
    } elseif (mb_is_single_user()) {
        $title = mb_get_single_user_title();
    } elseif (mb_is_user_archive()) {
        $title = mb_get_user_archive_title();
    } elseif (mb_is_search()) {
        $title = mb_get_search_page_title();
    } elseif (mb_is_forum_login()) {
        $title = mb_get_login_page_title();
    } else {
        $title = __('Board', 'message-board');
    }
    return apply_filters('mb_wp_title', $title);
}