• Hi, am working on a plugin that inserts both javascript and stylesheet in wp header. A user reported a problem: qTranslate adds the language tag to the stylesheet URL (breaking it) while the javascript URLs are left in tact.

    This confuses me because both stylesheet and script are enqueued in the same way. A code snippet from my plugin:

    // then register our version
    wp_enqueue_script('jquery.mousewheel', plugins_url(FANCYBOX_SUBDIR, __FILE__).'/fancybox/jquery.mousewheel-'.MOUSEWHEEL_VERSION.'.pack.js', array('jquery'), MOUSEWHEEL_VERSION);
    
    // register style
    wp_enqueue_style('easy-fancybox.css', plugins_url(FANCYBOX_SUBDIR, __FILE__).'/easy-fancybox.css.php', false, FANCYBOX_VERSION, 'screen');

    How can it be that qTranslate inserts a language tag (like /en/ for english) into the stylesheet URL while the script URL is not changed?

    https://www.ads-software.com/extend/plugins/qtranslate/

Viewing 1 replies (of 1 total)
  • Hmmm… I found that it is the .php extension for the enqueued stylesheet that makes the difference. Removing that, so it becomes an URL ending in .css will result in an unconverted URL (without the language tag).

    Looking through the qTranslate code I found in the main qtranslate.php the lines

    // Don't convert URLs to this file types
    $q_config['ignore_file_types'] = 'gif,jpg,jpeg,png,pdf,swf,tif,rar,zip,7z,mpg,divx,mpeg,avi,css,js';

    and after appending ,php to the string, my enqueued file URL is no longer converted.

    Would it not be wiser (if possible) to exclude ALL wp_enqueued files from URL conversion by default instead of depending on a list of file types like this?

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: qTranslate] language tag in wp_enqueue_style() url’ is closed to new replies.