Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 1 replies (of 1 total)
  • Well I was hoping someone would post a shorttag that I could use but I just wrote a PHP script to achieve the results I was looking for. Just in case someone else is looking to do the same here is the script I used:

    <?php
    // Set  id based on pagetitle or url for BP pages.
    $url = $_SERVER;
    $pagetitle = wp_title("","0");
    $pagetitle = strtolower(str_replace(' ', '', ltrim($pagetitle)));
    if (strlen($pagetitle) == 0 && $url == '/sbs/groups/') {
    $pagetitle = 'groups';
    } elseif (strlen($pagetitle) == 0 && $url == '/sbs/forums/') {
    $pagetitle = 'forum';
    } elseif (strlen($pagetitle) == 0 && $url == '/sbs/') {
    $pagetitle = 'home';
    }
    ?>

    How it works: It will take the pagetitle and strip it down into a web standards friendly id and insert it into the tag. If the page does not have a pagetitle set, like for example like the forums and groups pages in Buddypress then it will set a id based on the URL.

    So to insert the custom body tag id you put in <body id=&quot;">

    Hope this helps someone.

Viewing 1 replies (of 1 total)
Skip to toolbar