Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to include any file.php via a hook ?


  • Marco72
    Participant

    @marco72

    Hello, here’s what I’ve done in functions.php:

    /*define constant*/
    define(‘childtheme_DIR’, STYLESHEETPATH);

    then:

    /*here we insert, after the regular sidebar,childtheme’s left sidebar*/
    add_action(‘bp_after_sidebar’, ’childtheme_include_sidebar_left’);
    function childtheme_include_sidebar_left() {
    require(childtheme_DIR.’/sidebar_left.php’);
    }

    But this does not load the sidebar_left.php givin an error of file/folder not found in child theme dir, even though is actually there and I can’t figure why. I use this method with frameworks like Hybrid, Thematic and the new Genesis and it always works well.

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

  • Marco72
    Participant

    @marco72

    Bump!


    modemlooper
    Moderator

    @modemlooper

    If you want to include another side bar you can do it like this in the theme files

    <?php locate_template( array( 'sidebar-left.php' ), true ) ?>


    Marco72
    Participant

    @marco72

    Thanks, but my goal is to leave the Bp Default template files untouched, so that at every new Bp release I’m not gonna edit every file. I’ll use just a Child css and a functions.php file.

    This is an issue though isn’t it? copying a file over to a child theme is an excepted practise with WP and how one legitimately extends themes. If we are to run scared of doing this because the core bp-default files may be upgraded/changed then it suggests that one cannot really extend or create themes safely, short of having to copy over new files and adding all your customisations to it again.

    I’m wondering whether I can safely set about creating a full blown theme, in as much as I’m not sure at this stage how dependent BP is on it’s default theme files.

    (Sorry bit of a thread hijack.)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to include any file.php via a hook ?’ is closed to new replies.
Skip to toolbar