[resolved] get_template_directory_uri() issues with sub-directory theme (7 posts)

  1. WebMaestro.Fr
    Posted 4 years ago #

    Hi there !

    Well, my main install is under http://www.site.com/blog,
    my sub-directory install is under http://www.site.com/blog/travels.

    Within the theme "Roots",
    echo get_template_directory_uri();
    give me
    ... all good.

    wp_enqueue_style('roots_bootstrap', get_template_directory_uri() . '/css/bootstrap.css', false, null);
    give me
    <link rel="stylesheet" href="/blog/travels/blog/travels/wp-content/themes/roots/css/bootstrap.css">

    Curious isn't it ?!

    Same for the stylesheets called from the plugins, but only with this theme ! The same plugin's stylesheets called from another theme (TwentyEleven) works fine !

    Could it be an URL rewriting somewhere ? My .htaccess seems find with the other themes.

    I would appreciate your help on that one folks.

  2. WebMaestro.Fr
    Posted 4 years ago #

    Okay, the problem was coming from the theme, of course.

    To avoid this, modify /wp-content/themes/roots/inc/config.php
    and just turn those two lines (6 and 7) to comments :

    // add_theme_support('root-relative-urls');    // Enable relative URLs
    // add_theme_support('rewrite-urls');          // Enable URL rewrites

    Fixed the problem for me.

  3. thehobbo
    Posted 3 years ago #

    Great find.
    Many thanks

  4. xcded
    Posted 3 years ago #

    Don't forget to use
    <?php wp_head(); ?>
    in your header.php

  5. sb_surinder
    Posted 3 years ago #

    Thank You

  6. a2d
    Posted 3 years ago #


  7. robheath
    Posted 3 years ago #

    Thanks, @WebMaestro.Fr - That worked for me!!!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic