Skip to:
Content
Pages
Categories
Search
Top
Bottom

template tag for child theme javascript?


  • Mike
    Participant

    @suchaqd

    Hey guys – So I was trying to reference a javascript in my bp child theme using the ‘template_url’ template tag when I noticed that it pointed to the BP plugin directory instead of the theme directory. I ended up using the ‘url’ tag and entered the rest of the address manually, which worked, but I was wondering if there’s a better way around it. If not, no biggie… but if there is, please share =)

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

  • modemlooper
    Moderator

    @modemlooper

    include( TEMPLATEPATH . ‘/custom.js’ );

    Not sure if that’s what you were asking for but if you are creating a site for your self its better on a server to not use php to call this file and just hard code the direct link.


    Mike
    Participant

    @suchaqd

    Thanks =) Yeah, I’ll hard-code it instead. I was hoping something along the lines of bloginfo(‘childtheme_url’) … like an actual template tag but it’s really no biggie. Kind of like a math problem… lots of different methods to arrive at the same solution.


    thekmen
    Participant

    @thekmen

    how about get_stylesheet_directory_uri()?


    Mike
    Participant

    @suchaqd

    That’s only for CSS =( I suppose, you could point to that and then go outside of it… maybe, possibly… but that’s still kind of a hack way of going about it, haha. Ah well, like I said… no biggie.


    r-a-y
    Keymaster

    @r-a-y

    Actually thekmen is right.

    get_stylesheet_directory_uri() should return the URL to your child theme.

    Also, re: TEMPLATEPATH – I’d use STYLESHEETPATH instead.

    get_stylesheet_directory_uri() should return the URL to your child theme.

    As does bloginfo(‘stylesheet_directory’)

    One returns result the other needs echoing, other than that is there a preference?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘template tag for child theme javascript?’ is closed to new replies.
Skip to toolbar