• I’m in the process of modifying an install of wp e-commerce plugin.
    One of the customisations is the inclusion of some social media buttons.

    I am calling them manually rather than using a plugin for a number of reasons and the method I am using is by using php include to call a php file containing the relevant code for the buttons.

    This method work great for my theme files (e.g. single.php) but I also want to add it to a WPEC theme file (which is stored in wp-content/plugins/wp-e-commerce/themes/default). My social button code file is stored in my theme directory so I added this code to the WPEC theme file:

    <?php
    $path = bloginfo('template_directory') . '/social_buttons.php';
    include $path;
    ?>

    But I receive an error:

    http://localhost/serge/wp-content/themes/serge
    Warning: include(/social_buttons.php) [function.include]: failed to open stream: No such file or directory in C:\xampplite\htdocs\serge\wp-content\plugins\wp-e-commerce\themes\default\single_product.php on line 247

    Warning: include() [function.include]: Failed opening ‘/social_buttons.php’ for inclusion (include_path=’.;\xampplite\php\PEAR’) in C:\xampplite\htdocs\serge\wp-content\plugins\wp-e-commerce\themes\default\single_product.php on line 247

    Any ideas?

    Edit: When I just echo $path it outputs: http://localhost/serge/wp-content/themes/serge/social_buttons.php which is correct. So why doesn’t it include properly?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘php include problem’ is closed to new replies.