Skip to:
Content
Pages
Categories
Search
Top
Bottom

Parent Forum Name in


  • AdventureCanoe
    Member

    @adventurecanoe

    I’m trying to get the parent forum name in the title tag.

    I made a plug in that takes care of most of it…

    <?php
    /*
    Plugin Name: Better Titles
    Author: James Dixson
    */
    add_filter('bb_title', 'titlemodify');

    function titlemodify( $title ) {
    //your code that does something to $title;

    switch ( bb_get_location() ) {
    case 'topic-page':
    $title = get_topic_title() . ' - ' . get_forum_name() . ' — Adventure Canoe Forum' ;
    break;

    case 'front-page':
    $title = bb_option('name') . ' — Canoeing and Paddling Discussion' ;
    break;

    case 'forum-page':

    $find = 'Canoe';
    $string = get_forum_name() ;
    if(strstr($string,$find)){
    $title = get_forum_name() . ' — Adventure Canoe Forum' ;
    }else{
    $title = 'Canoe ' . get_forum_name() . ' — Adventure Canoe Forum' ;
    }

    break;
    }
    return $title;
    }
    ?>

    You can see it in action at http://www.adventurecanoe.com/forum

    Now what I want to add is something that does this

    Parent Forum Name — Forum Name — Forum Title

    Basically if you went to the page http://www.adventurecanoe.com/forum/forum/rivers the title tag would read:

    Canoeing Destinations — Rivers — Adventure Canoe Forum

Viewing 1 replies (of 1 total)
  • Not the cleanest way of doing it no doubt, but I’d use something like this modified version of the breadcrumb function:

    <?php
    $separator = ' -- ';

    if( bb_is_forum() ) :
    $trail = '';
    $trail_forum = bb_get_forum(get_forum_id());
    $current_trail_forum_id = $trail_forum->forum_id;
    while ( $trail_forum && $trail_forum->forum_id > 0 ) {
    $crumb = $separator;
    $crumb .= get_forum_name($trail_forum->forum_id);
    $trail = $crumb . $trail;
    $trail_forum = bb_get_forum($trail_forum->forum_parent);
    }
    $title = substr( $trail . $separator . bb_get_option( 'name' ), strlen( $separator ) );
    else :
    $title = bb_get_title( array( 'separator' => $separator ) );
    endif;
    ?> <title><?php echo $title?></title>

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