Skip to:

adding scripts to header

  • hello,

    i’ve tried to add ** to /mytheme/header.php ( inside the head tags of course) –


    <script type=”text/javascript” src=”js/jquery.js”></script>

    <script type=”text/javascript” src=”js/jquery.accordion.js”></script>

    <script type=”text/javascript” src=”js/jquerycustom.js”></script>

    but it does’nt work so far, is there a special bbpress rule for 3rd party scripts?

    it works as standalone version, but the integration in bbpress fails big time.


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

  • chrishajer


    What do you mean does not work? What appears in the <head> section of the rendered pages? Post your edited header.php as well.

    And you should probably use bb_enqueue_script (or maybe it’s wp_enqueue_script depending on the version you’re running.) That prevents loading a script more than once, I believe.

    hello chris,

    i’m actually not able to run the first accordion of inside of mytheme/front-page.php

    here is my header.php part

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
    <html xmlns=""<?php bb_language_attributes( '1.1' ); ?>>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php bb_title() ?></title>

    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.accordion.js"></script>
    <script type="text/javascript" src="js/jqq.js"></script>

    <?php bb_feed_head(); ?>
    <link rel="stylesheet" href="<?php bb_stylesheet_uri(); ?>" type="text/css" />
    <?php if ( 'rtl' == bb_get_option( 'text_direction' ) ) : ?>
    <link rel="stylesheet" href="<?php bb_stylesheet_uri( 'rtl' ); ?>" type="text/css" />
    <?php endif; ?>

    <?php bb_head(); ?>


    <body id="<?php bb_location(); ?>">

    ........ etc

    and the front-page.php part:

    <div class="basic" id="list1b">

    You've seen it coming!
    Buy now and get nothing for free!


    your bear, you have to admit it!
    No, we aren't selling bears.


    get two for three beer.

    And now, for something completely different.
    And now, for something completely different.


    get two for three beer.

    And now, for something completely different.
    And now, for something completely different.



    jqq.js is:

    // simple accordion
    autoheight: false

    // second simple accordion with special markup
    active: false,
    header: '.head',
    navigation: true,
    event: 'mouseover',
    fillSpace: true,
    animated: 'easeslide'

    // highly customized accordion
    event: 'mouseover',
    active: '.selected',
    selectedClass: 'active',
    animated: "bounceslide",
    header: "dt"
    }).bind("change.ui-accordion", function(event, ui) {
    jQuery('<div>' + ui.oldHeader.text() + ' hidden, ' + ui.newHeader.text() + ' shown</div>').appendTo('#log');

    // first simple accordion with special markup
    header: 'div.title',
    active: false,
    alwaysOpen: false,
    animated: false,
    autoheight: false

    var wizard = $("#wizard").accordion({
    header: '.title',
    event: false

    var wizardButtons = $([]);
    $("div.title", wizard).each(function(index) {
    wizardButtons = wizardButtons.add($(this)
    .filter(".next, .previous")
    .click(function() {
    wizard.accordion("activate", index + ($(this).is(".next") ? 1 : -1))

    // bind to change event of select to control first and seconds accordion
    // similar to tab's plugin triggerTab(), without an extra method
    var accordions = jQuery('#list1a, #list1b, #list2, #list3, #navigation, #wizard');

    jQuery('#switch select').change(function() {
    accordions.accordion("activate", this.selectedIndex-1 );
    jQuery('#close').click(function() {
    accordions.accordion("activate", -1);
    jQuery('#switch2').change(function() {
    accordions.accordion("activate", this.value);
    jQuery('#enable').click(function() {
    jQuery('#disable').click(function() {
    jQuery('#remove').click(function() {

    info: the js-parts are in the “theme” root (kakumei/js/) , the css parts of the accordion are merged into the original kakumei stylesheet.

    thanks so far.



    How about using the full URI to the javascript? In your script tags, you can use a template tag to add the template path including where you stored the files. Once you are sure they’re referenced properly and actually being loaded, you can go from there.

    <script type="text/javascript" src="<?php bb_active_theme_uri(); ?>js/jquery.js"></script>
    <script type="text/javascript" src="<?php bb_active_theme_uri(); ?>js/jquery.accordion.js"></script>
    <script type="text/javascript" src="<?php bb_active_theme_uri(); ?>js/jqq.js"></script>

    And when you say “doesn’t work so far” do you mean it’s like the javascript is just not there, no action, or something else?

    hey chris that worked, i mean the uri fix.

    thanks a bunch.



    I’m having the same problem with a floating.js script. It works fine on my main site, but not on the bbpress site. Implementation is identical.

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