Support » Themes and Templates » Lynda.com – Building an online portfolio

  • Resolved clarenceperez

    (@clarenceperez)


    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?

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

    (@mar1965)

    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');
    ?>

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    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

    mar1965

    (@mar1965)

    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?

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

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

    clarenceperez

    (@clarenceperez)

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Lynda.com – Building an online portfolio’ is closed to new replies.