Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get the title of current item


  • wzshop
    Participant

    @wzshop

    Hi,
    I would like to know how to get the (translated) title of the current item.
    For instance when i go to groups, it says in the <header><title> tag the correct and translated title. How do i get this title in a page template?

    i tried: echo bp_current_component(); but this just echo’s the slug i guess and not the correct title.

    Thans a lot!

Viewing 1 replies (of 1 total)

  • wzshop
    Participant

    @wzshop

    Ok, well i managed to do this by the following code (if anyone ever needs it):

    <?php $bp_title_parts = bp_modify_document_title_parts();
     // let's rebuild the title here
    $title = $bp_title_parts['title'];
    if( strpos( $title, 'E-mail' ) !== false ) {echo '<h2>'.substr($title, 0, strpos($title, '-', strpos($title, '-')+1)).'</h2>';}else {echo '<h2>'.substr($title, 0, strpos($title, "-")).'</h2>';}
    ?>

    This will show the first part of the $title, cutting of the rest after the ‘-‘ in the variable.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar