Skip to:
Content
Pages
Categories
Search
Top
Bottom

code for refrencing template directory


  • startribe
    Member

    @startribe

    Hey Community,

    I am trying to link to an image in the “my-templates” directory for my bbpress template. When editing templates in WordPress I used:

    <?php bloginfo('stylesheet_directory'); ?>

    Is there something similar that I can use for bbPress?

    I tried:

    <?php bb_stylesheet_uri(); ?>

    & it didn’t work.

    Anyhow, any help would be greatly appreciated.

    Thanks,

    Orion

Viewing 8 replies - 1 through 8 (of 8 total)
  • <?php bb_stylesheet_uri(); ?> does work for me!?

    Anyways, you can also do something like following I did in bbpress-mobile plugin:

    <?php $stylesheet = (bb_get_option('uri') . 'my-templates/mobile.css'); ?>

    <link rel="stylesheet" href="<?php echo $stylesheet; ?>" type="text/css" />

    Trent


    startribe
    Member

    @startribe

    Hey Trent,

    Thanks for the reply…

    I checked out the source of the resulting page and found this…

    /my-templates/style.cssimages/victorylogo.gif

    So I noticed that it is posting “style.css” in the path, which is throwing me off.

    Essentially, I am trying to get into my “my-templates” directory. I will look into your other solution. If you have any other ideas, I am open ears.

    Thanks,

    Orion

    If you are trying to get victorylogo.gif, I would use:

    <?php $victorylogo = (bb_get_option('uri') . 'my-templates/images/victorylogo.gif'); ?>

    <?php echo $stylesheet; ?>

    There might be an easier way, but I am a ‘may not be pretty, but works’ type of guy….

    Trent


    startribe
    Member

    @startribe

    lol…

    yeah, any solution is good to start for me. The above produced:

    front-pageimages/victorylogo.gif

    I am editing the front-page.php, so I am not sure if it pulled that file name or I have a setting a bit off somewhere.

    Hmmm…. there has to be a way. I am getting the images to load through CSS, but for this particular image I would like to have it in the HTML content.

    So any more ideas or suggestions are welcome.

    -Orion


    startribe
    Member

    @startribe

    actually, I forgot to load the file, the result above was from playing with

    ‘<?php bb_location(); ?>’ and “image”.

    After trying your code Trent, I received no results for the designated area:

    src=""


    startribe
    Member

    @startribe

    YES! I got it… I used this to get the correct path:

    <?php bb_option('uri'); ?>my-templates/images/victorylogo.gif

    Ahhhh, and sigh. Trent, thanks for helping with getting my gears going. Now if anyone else runs into a similar issue, they will have a solution.

    All the Best,

    Orion

    Looking back at the code I put, I must have been tired! Great to hear you got it going Orion!

    Trent


    startribe
    Member

    @startribe

    Thanks Trent, I am still pushing along… I understand, those late nights get to me too.

    All the Best,

    Orion

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

You must be logged in to reply to this topic.