Skip to:
Content
Pages
Categories
Search
Top
Bottom

template tag for child theme javascript?

  • 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)
  • Avatar of @modemlooper
    @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.

    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.

    Avatar of thekmen
    thekmen
    Participant

    @thekmen

    how about get_stylesheet_directory_uri()?

    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.

    Avatar of r-a-y
    r-a-y
    Moderator

    @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.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    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)

You must be logged in to reply to this topic.