Forums

TEMPLATEPATH or bloginfo('template_url')? (2 posts)

  1. haradeep
    Member
    Posted 1 year ago #

    TEMPLATEPATH or template_url?

    What is the main difference between these two?

    I'm bit confused.

  2. Digital Raindrops
    Member
    Posted 1 year ago #

    TEMPLATEPATH this is the physical path within the themes folder, to load a file called theme options.

    if (file_exists(TEMPLATEPATH .'/theme-options.php')) include(TEMPLATEPATH .'/theme-options.php');

    Where get_template_directory_uri() can be used to register a custom stylesheet or load a header image at runtime, this is for the HTML rendering and will require the URL

    wp_register_style( 'mycustomstyle', get_template_directory_uri() .'/styles/buckingham.css', '', '0.1' );
    wp_enqueue_style( 'customstyle' );

    This would load the stylesheet at runtime, here is an example where you can see the url for a custom stylesheet, you can see both examples here.

    <link rel='stylesheet' id='customstyle-css'  href='http://theme.digitalraindrops.net/wp-content/themes/raindrops-magazine/styles/buckingham.css?ver=0.1' type='text/css' media='all' />

    For a child theme files that are not in the parent!
    STYLESHEETPATH and get_stylesheet_directory_uri()

    HTH

    David

Topic Closed

This topic has been closed to new replies.

About this Topic