sage icon indicating copy to clipboard operation
sage copied to clipboard

Did what I'm doing is wrong?

Open jauhari opened this issue 14 years ago • 3 comments

For some reason I try to disable Mod Rewrite by edit and add comment on 3 fist code on config.php

Here is the code that I was commented

//add_theme_support('root-relative-urls');
//add_theme_support('rewrite-urls');
//add_theme_support('h5bp-htaccess');

For some reason that I can't understand my theme still access the css with http://domain.com/css/blablba.css So I try to looking at the code and we found some code on scripts.php and explore on it. Then I try to modified this code become like this

<?php

function roots_scripts() {
  wp_enqueue_style('roots_bootstrap_style', get_template_directory_uri().'/css/bootstrap.css', false, null);

  if (current_theme_supports('bootstrap-responsive')) {
    wp_enqueue_style('roots_bootstrap_responsive_style', get_template_directory_uri().'/css/bootstrap-responsive.css', array('roots_bootstrap_style'), null);
  }

  // If you're not using Bootstrap, include H5BP's main.css:
  // wp_enqueue_style('roots_style', '/css/main.css', false, null);

  wp_enqueue_style('roots_app_style', get_template_directory_uri().'/css/app.css', false, null);

  if (is_child_theme()) {
    wp_enqueue_style('roots_child_style', get_stylesheet_uri());
  }

  if (!is_admin()) {
    wp_deregister_script('jquery');
    wp_register_script('jquery', '', '', '', false);
  }

  if (is_single() && comments_open() && get_option('thread_comments')) {
    wp_enqueue_script('comment-reply');
  }

  wp_register_script('roots_plugins', get_template_directory_uri().'/js/plugins.js', false, null, false);
  wp_register_script('roots_main', get_template_directory_uri().'/js/main.js', false, null, false);
  wp_enqueue_script('roots_plugins');
  wp_enqueue_script('roots_main');
}
add_action('wp_enqueue_scripts', 'roots_scripts', 100);

Now after modified by added get_template_directory_uri() now the CSS accesed the right URL. My question is did what I'm doing is correct? or any clue how to fix it?

Best Regards

Jauhari

jauhari avatar Jun 17 '12 05:06 jauhari

Nope, that's a perfect solution. Although that is currently a bug which we'll be fixed soon.

We shouldn't be hardcoding /css or /js if we also make them optional.

swalkinshaw avatar Jun 17 '12 15:06 swalkinshaw

dupe #478

retlehs avatar Jun 17 '12 16:06 retlehs

Thanks you

jauhari avatar Jun 18 '12 01:06 jauhari