• Hi,
    I’m developing a new theme from scratch and have set up a theme directory with:
    style.css
    index.php
    home.php
    single.php
    single-<my-custom-posttype>.php
    header.php
    footer.php

    The setting for the WP installation are pretty much vanilla at present.

    The problem I’m having is that when I define a function in functions.php it is available in index.php & home.php but NOT in the single templates.

    So, for example, I have a template tag defined in functions.php as follows but cannot make use of it in single.php

    if (! function_exists('my_function')) {
      function my_function() {
        echo "Something";
      }
    }

    I have followed the documentation on setting up a theme and have ensured that wp_head() is called before the closing head tag.

    Naturally I expect WP to ‘just work’, that being one of the major attractions, so I’m a bit flummoxed here!

    Any suggestions?

    Thanks,
    Ian

  • The topic ‘New theme – functions.php not included in single.php’ is closed to new replies.