Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Find the Correct Theme Path for Child Themes?


  • bpisimone
    Participant

    @bpisimone

    I’m currently trying to adapt my custom theme to the BP 1.1 Beta which is working out quite nice. However I have one issue about calling the templatepath. I’ve read about it before here (bottom comments by Detective), but I’m not sure how to actually solve the problems.

    The setup is BP 1.1, WPMU 8.4a all working perfectly. It’s just a parent/child theme issue that I’m not sure how to solve (with locate_template)

    1. For one I tried to replicate the custom login page with this:

    echo '<link rel="stylesheet" type="text/css" href="' . locate_template('template_directory') . '/custom-login/custom-login.css" />';

    With the custom-login folder placed in the bp-default theme, which does not work.

    2. Also I tried to import my various functions from the old theme (this gives me a white screen). In my functions.php I forward to

    require_once (TEMPLATEPATH . '/library/functions/theme_variables.php');

    and define the functions path in theme_variables.php:

    $functions_path = TEMPLATEPATH . '/library/functions/';

    now they should be working when I call them from functions.php like this:

    require_once ($functions_path . 'buddypressfunctions.php');

    Thanks a bunch everyone!

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

  • Jeff Sayre
    Participant

    @jeffsayre

    You do not have the proper syntax for locate_template().

    Look here: https://trac.buddypress.org/changeset/1742/trunk


    bpisimone
    Participant

    @bpisimone

    Thanks Jeff!

    I’m trying, but it’s not working so far. Shouldn’t it look something like this?

    $functions_path = locate_template( array( '/library/functions/' ), true );

    require_once locate_template( array( '/library/functions/theme_variables.php' ), true );

    Here I’m not sure what to do because it’s wrapped in echo and href:

    echo '<link rel="stylesheet" type="text/css" href="' . locate_template('template_directory') . '/custom-login/custom-login.css" />';


    bpisimone
    Participant

    @bpisimone

    For number one I tried this here,

    echo '<link rel="stylesheet" type="text/css" href="' locate_template( array( 'custom-login/custom-login.css' ), true)'" />';

    It gets me this error

    PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /Users/(...)/Sites/wordpress.mu/wp-content/themes/bp-default/functions.php on line 7

    For number two I have:

    require_once locate_template( array( 'library/functions/theme_variables.php' ), true );

    and I get this error:

    PHP Warning: require_once(/Users/(...)/Sites/wordpress.mu/wp-content/themes/bp-default/library/functions/) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /Users/(...)/Sites/wordpress.mu/wp-includes/theme.php on line 843

    Thanks a lot for more pointers in the right direction, it’s puzzling me for the whole day, unfortunately.


    epsi
    Participant

    @epsi

    use stylesheet_directory instead.

    No don’t. locate_template() is what you should use.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to Find the Correct Theme Path for Child Themes?’ is closed to new replies.
Skip to toolbar