Skip to:
Content
Pages
Categories
Search
Top
Bottom

Include js from folder outside WP in themes

  • Avatar of Peterverkooijen
    peterverkooijen
    Participant

    @peterverkooijen

    I have a folder called /common where I keep lots of reusable stuff; images, js, flash, etc. Like this:

    mywebsite.com/common

    How can I use these elements in the themes without having to resort to “http://mywebsite.com/common/etc.”?

    Is there a version of bloginfo() to get the main URL of the site?

    What is the prescribed way to add js to the header?

Viewing 1 replies (of 1 total)
  • Avatar of Peterverkooijen
    peterverkooijen
    Participant

    @peterverkooijen

    This seems to word for including a php file:

    <? include get_option(‘home’).’/common/whatever.php'; ?>

    And adding this to header.php in the theme also seems to work:

    ‘<script src=”<? echo get_option(‘home’) ?>/common/js/whatever.js” type=”text/javascript”></script>’

    Best solution?

Viewing 1 replies (of 1 total)

The topic ‘Include js from folder outside WP in themes’ is closed to new replies.