WordPress.org

Forums

[resolved] Lynda.com - Building an online portfolio (6 posts)

  1. clarenceperez
    Member
    Posted 2 years ago #

    Hello,

    It works on the video, as they told, I created a file called posttypes.php into the theme folder containing this code:

    <?php
    echo "Hello!";
    ?>

    I have made a file called functions.php put into the child theme cooking:

    <?php
    include_once(ABSPATH . 'wp_content/themes/posttypes.php');
    ?>

    As a consequence, I should have visually outputten a Hello! This is not the case, I have the following error output: Warning: include_once(C:\wamp\www\portfolio/wp_content/themes/posttypes.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in C:\wamp\www\portfolio\wp-content\themes\cooking\functions.php on line 2' and

    Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening 'C:\wamp\www\portfolio/wp_content/themes/posttypes.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\portfolio\wp-content\themes\cooking\functions.php on line 2

    What did I fail?

  2. mar1965
    Member
    Posted 2 years ago #

    Hi Clarence,

    I am noticing a mixture of forward and back slashes, but am not a hundred percent certain that is the cause. In your code:

    <?php
    include_once(ABSPATH . 'wp_content/themes/posttypes.php');
    ?>

    try changing the forward slashes to back slashes:

    <?php
    include_once(ABSPATH . 'wp_content\themes\posttypes.php');
    ?>
  3. Andrew
    Nuh uh moderator
    Posted 2 years ago #

    Replace the underscore in wp_content with a hyphen.
    Then add your theme name after wp-content.

    E.g;

    wp-content/themes/yourThemeName/posttypes.php
  4. mar1965
    Member
    Posted 2 years ago #

    Wow Andrew! Thanks for pointing that out! Such a minor detail that I totally missed. So in a Windows install, when the forward and back slashes are mixed up like that, does it not matter? Or is it because the theme name was not included, along with the underscore rather than a hyphen that caused the slashes to get mixed up like that?

  5. Andrew
    Nuh uh moderator
    Posted 2 years ago #

    You can test which was causing the problem by removing one suggestion and seeing whether the error persists.

  6. clarenceperez
    Member
    Posted 2 years ago #

    Thanks guys, it is fixed. I just put the right caracter wp-content!

Topic Closed

This topic has been closed to new replies.

About this Topic