Skip to:
Content
Pages
Categories
Search
Top
Bottom

Unique Style Sheet?

  • Hi all,

    I am currently configuring BBPress for my site at http://www.babyquestions101.com‘s forum, and by the looks of it it’s very promising.

    I am trying to figure out if I can call a specific stylesheet for a specific page by making that call in the body page.

    For instance, I know how to call multiple stylesheets through header.php. However, I would like to be able to specify a stylesheet through a page like forum.php, so that it dynamically tells header.php to call the stylesheet specific (or unique) to that page. I want this so that I can lean up my code, instead of calling everything in one css file.

Viewing 14 replies - 1 through 14 (of 14 total)
  • in header.php check is_forum() or is_topic() or so on and call stylesheets accordingly..

    I know that this is a little off topic, but you have some great looking sites Ron! Wow!

    Trent

    Really? Thanks, man. Which sites have you seen, just out of curiosity?

    I did the search from your profile to the links for your family site, personal site and obviously the link you gave above. I am sure there are more that you have done, but you have a great way with color mixtures. That is impressive!

    Trent

    Thanks again. Hey, since I have you here, maybe I can ask you a quick one…I’m looking for a way to display content solely based on whether it’s a wordpress page or a bbpress page. For instance, I would like to have the login controls for the wordpress site be in the sidebar when wp is loaded, and the bbpress controls there when bb is loaded.

    I imagine it wouldn’t matter which way the user logged in, but there are a few things I would like which I haven’t been able to achieve due to the way I have to put absolute path for redirects, etc. Here are the features I need, maybe you can suggest a more elegant solution for them?:

    - Login Redirects to last visited page

    - Display selective content based on which side the user’s on (bb vs wp)

    - I seem to be having some issues with relative paths? (Actually, I think I may have just figured this out, and I may just be dumb)

    - Some other thing I’ll ask about in 7 minutes or less, I’m sure…

    I’m a beginner, but not a newb. (anymore). I feel I am getting a pretty good grasp, but I still get confused now and again. Thanks for any feedback you can give.

    - Login Redirects to last visited page

    It seems to me that if you are integrated, both bbPress and WP use the wp_users table in the database so wherever you login will be redirected to the last visited page (as both programs do this now). It is easy to have th login in the header.php of your template in bbPress and just adding the login box to WP in sidebar also has login on every page.

    - Display selective content based on which side the user’s on (bb vs wp)

    Once again, I think this is done by default. WP has its theme and content. bbPress has its theme and content.

    - I seem to be having some issues with relative paths? (Actually, I think I may have just figured this out, and I may just be dumb)

    Relative paths are easy to figure out, we can go into this more if you didn’t get it.

    - Some other thing I’ll ask about in 7 minutes or less, I’m sure…

    Shoot. That is what we are here for.

    Trent

    Once again, I think this is done by default. WP has its theme and content. bbPress has its theme and content.

    As usual..more details.

    I am really trying to use elements from wp on the bb side, such as sidebar…so I’m calling

    <?php get_sidebar(); ?>

    on pages like this one:

    http://babyquestions101.com/forum/

    However, I have so many questions as to how to handle the login box in sidebar…Should it:

    - Go to BBPress login/register page always (wp or bb)

    - Go to WP login/register page always

    - Go to respective login/register pages depending on which side the click originated?

    Then, depending on that configuration, redirect questions ensue.

    I know this is probably a matter of preference, but I’m indifferent, and wondering what will overall be the best solution for the user. Any suggestions will be greatly appreciated.

    - Login Redirects to last visited page

    It seems to me that if you are integrated, both bbPress and WP use the wp_users table in the database so wherever you login will be redirected to the last visited page (as both programs do this now). It is easy to have th login in the header.php of your template in bbPress and just adding the login box to WP in sidebar also has login on every page.

    I have already made a tweak to the redirect in wp-admin to go back to the homepage in wp. I did this because it was redirecting to the profile.php page when a user logged in, instead of to the last page they were visiting. Is that the default behavior, or did I miss something? I am on wp v.2.0.5, so maybe something has changed in version 2.1 which changes this behavior?

    Ron

    Ron,

    Having the sidebar on the side of bbPress I guess is something I have never tried to do. I guess there is no reason why it wouldn’t work. With the integration plugin, all registrations of bbPress become WP registrations so I don’t think it matters if they register in bbPress or WP as they all become WP users (and obviously bbPress users as well).

    I have the login box in WP in the sidebar, so whatever page I am on when I login at, it stays on that page. That is the only way around it regardless of WP version. If you integrate the sidebar into bbPress theme, I would imagine the same would happen on that side as well.

    Sorry, what other questions did you have as I am posting pretty quickly here….lol

    Trent

    So, maybe my problem is that I haven’t included ALL the code from wp-login in the sidebar…instead I’ve just included the code necessary to get them redirected to the wp-login.php to actually be logged in…Here’s what it looks like. Maybe you can make sense of it:

    <!--BEGIN SIDEBAR-->
    <?php

    $user_login = '';
    $user_pass = '';
    $using_cookie = false;
    if ( !isset( $_REQUEST['redirect_to'] ) )
    $redirect_to = 'wp-admin/';
    else
    $redirect_to = $_REQUEST['redirect_to'];

    if( $_POST ) {
    $user_login = $_POST['log'];
    $user_login = sanitize_user( $user_login );
    $user_pass = $_POST['pwd'];
    $rememberme = $_POST['rememberme'];
    } else {
    $cookie_login = wp_get_cookie_login();
    if ( ! empty($cookie_login) ) {
    $using_cookie = true;
    $user_login = $cookie_login['login'];
    $user_pass = $cookie_login['password'];
    }
    }

    do_action('wp_authenticate', array(&$user_login, &$user_pass));

    ?>

    <span class="sidenav_top">&nbsp;</span>
    <ul class="sidenav_body" style="">
    <li><h2>Login:</h2></li>

    <?php

    global $userdata;
    get_currentuserinfo();
    global $user_identity;

    if (!$userdata) {
    ?>

    <li style="padding-left: 10px; overflow: hidden;">
    <form name="loginform" id="loginform" action="/wp-login.php" method="post">
    <p style="margin: 0px; height: 25px; width: 175px;">
    <label style="font-size: 11px; text-align: right; width: 76px; display: block; float: left; clear: left;"><?php _e('Username:') ?>&nbsp;</label>

    <input style="float: right;" type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1); ?>" size="13" tabindex="1" />
    </p>
    <p style="margin: 0px; height: 25px; width: 175px;">
    <label style="font-size: 11px; text-align: right; width: 76px; display: block; float: left; clear: left;"><?php _e('Password:') ?>&nbsp;</label>

    <input style="float: right;" type="password" name="pwd" id="pwd" value="" size="13" tabindex="2" />
    </p>
    <p style="margin: 0px; height: 22px; float: right; margin-right: 10px; clear: both;">
    <label style="font-size: 12px;"><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />
    <?php _e('Remember me'); ?></label></p>
    <p class="submit" style="height: 35px;">
    <input style="float: right; clear: both; margin-right: 10px;" type="submit" name="submit" id="submit" value="<?php _e('Login'); ?> &raquo;" tabindex="4" />
    <input type="hidden" name="redirect_to" value="index.php" />
    </p>
    </form>

    I am guessing the difference between how I have it set up and how you have it is that I am sending the user to wp-login whereas you are authenticating right there on that page. I tried to get the sidebar to do all the work, but I ran into errors I couldn’t fix on my own…do you have a suggestion for how I might handle the logins in the sidebar? Do you maybe have code I can look at to see how you’re doing it?

    It seems goofy to be discussing WP on a bbPress forum, but this is important for theme integration between the 2. Here is my login form in my sidebar (well ex sidebar as I use wordpress.com now). I use a conditional to welcome the user or display the login form.

     <li id="login">
    <?php
    global $user_ID, $user_identity;
    get_currentuserinfo();
    if (!$user_ID):
    ?>
    <label for="s"><?php _e('Login:'); ?></label>
    <ul>
    <li>
    <form name="loginform" id="loginform" action="<?php echo get_settings('siteurl'); ?>/wp-login.php" method="post">
    <div><label><?php _e('Login') ?>:<br /><input type="text" name="log" id="log" value="" size="15" tabindex="7" /></label><br />
    <label><?php _e('Password') ?>:<br /> <input type="password" name="pwd" id="pwd" value="" size="15" tabindex="8" /></label><br />
    <input type="hidden" name="rememberme" value="forever" />
    <input type="submit" name="submit" value="<?php _e('Login'); ?> &raquo;" tabindex="9" /><br />
    <?php wp_register('', ''); ?>
    <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/></div>
    </form></li>
    <li><script type="text/javascript">slvBanner();</script></li></ul>
    <?php
    else:
    ?>
    <label for="s">Welcome <?php echo $user_identity; ?>!</label>
    <ul>
    <?php wp_register(); ?>
    <li><a href="<?php echo get_settings('siteurl') . '/wp-login.php?action=logout&amp;redirect_to=' . $_SERVER['REQUEST_URI']; ?>"><?php _e('Logout'); ?></a></li>
    </ul>
    <?php
    endif;
    ?>
    </li>

    Trent

    Perfect.. Thanks. I had a few problems with my form…simple stuff. I added the proper redirects in the form, and it worked beautifully.

    Glad to here! Maybe a few release templates for bbPress then ;)

    Trent

    “Maybe a few release templates for bbPress then “

    is that a question, (or rather a request)?

    Just kidding around with a proven web developer! Nothing more!

    Trent

Viewing 14 replies - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.