• I’ve been working with WordPress for a few years now and I’d like to start building my own theme. While I’ve worked with much of the functionality by altering themes for others I want to know the guts of this stuff. This is what I’m stuck on now.

    Many themes I’ve worked with have a file called init.php, in which there are lines that define paths to directories and urls regarding local and network access.
    I understand this for setting paths for admin area functionality but to redefine TEMPLATEPATH like this
    define('PARENT_DIR', TEMPLATEPATH);
    to obtain this
    define('THEME_CORE_DIR', trailingslashit(PARENT_DIR).'core');
    seems redundant to me, and using trainingslashit instead of hard coding the “/” seems very heavy in code.
    why not do something like this?
    define('THEME_CORE_DIR', (TEMPLATEPATH).'/core');
    Also:
    I’ve seen child theme paths like this
    define('CHILD_URL', get_bloginfo('stylesheet_directory'));
    If the stylesheet_directory points toward the TEMPLATEPATH,
    then this is pointing to the stylesheet for the parent template. Is it not? Shouldn’t this be the correct call?
    define('CHILD_URL', get_bloginfo('stylesheet_directory').'/child');

    Maybe I’m missing something as a new theme developer from the bottom up.
    Any explanations would be appreciated.

  • The topic ‘Correct use Theme Constants?’ is closed to new replies.