Results 1 to 3 of 3

Thread: Help with errors from ..\wp-includes\theme.php

  1. #1
    Cais's Avatar
    Cais is offline Big Tipper
    Join Date
    Feb 2009
    Location
    Mississauga, ON, CANADA
    Posts
    349

    Default Help with errors from ..\wp-includes\theme.php

    One of my themes is throwing errors that I cannot reproduce:

    Warning: file() [function.file]: URL file-access is disabled in the server configuration in ..\wordpress\wp-includes\theme.php on line 180

    Warning: file(../wp-content/themes/desk-mess-mirrored/style.css) [function.file]: failed to open stream: no suitable wrapper could be found in ..\wordpress\wp-includes\theme.php on line 180
    Warning: implode() [function.implode]: Invalid arguments passed in ..\wordpress\wp-includes\theme.php on line 180
    I would expect all of them to have the same problem but I have no idea how to reproduce the issue so I'm hoping someone can point me in the right direction for debugging this.

    The above messages appear in the footer section and repeats two (2) times, the key code in the footer is this:

    PHP Code:
    <?php
    $blog_css_url 
    get_bloginfo('stylesheet_url');
    $theme_data get_theme_data($blog_css_url);
    echo 
    $theme_data['Name']; ?>
    v<?php echo $theme_data['Version']; ?>
    <?php
      $parent_blog_css_url 
    get_bloginfo('template_url') . '/style.css';
      
    $parent_theme_data get_theme_data($parent_blog_css_url);
      if (
    $blog_css_url != $parent_blog_css_url) {
        
    _e(' a child of the ''desk-mess-mirrored');
        echo 
    $parent_theme_data['Name']; ?>
        v<?php echo $parent_theme_data['Version'];
    Line 180 uses the exact same variable name $theme_data that I am using, would this be the culprit, or is there something else? If you go to my home web site you will not see this issue and I essentially use a minor child theme of Desk Mess Mirrored there with the exact same "key code" in the footer.

    Since this has only been reported twice, is there an ugly little band-aid I can wrap this in (temporarily) to capture these Warnings and output something else?

    Thanks for reading this far and any help that can be given will be appreciated.

  2. #2
    Otto's Avatar
    Otto is offline On The Rocks
    Join Date
    Apr 2009
    Location
    Memphis, TN
    Posts
    865

    Default

    get_theme_data() doesn't take a URL, it takes a local file path.

    Yes, since it uses the file function, then putting a URL in there will work, except when the fopen wrappers have been disabled, which they often are, for security reasons.

    In short, you're using get_theme_data() wrong. Don't give it a URL. Give it the full path to the style.css file.

    Instead of the two calls to get_bloginfo to get the URLs, use get_stylesheet_directory() and get_template_directory() instead.

  3. #3
    Cais's Avatar
    Cais is offline Big Tipper
    Join Date
    Feb 2009
    Location
    Mississauga, ON, CANADA
    Posts
    349

    Default

    Thanks Otto! I will look at the "directory" functions again, although I believe I tried using them when I first wrote the code and they were not returning the values I was expecting.

    I like the code I wrote, but it was more a "because I could" than a real need.

    PS: @Otto - the new directory functions appear to do the trick. The next update will have the corrections ... Thank You!
    Last edited by Cais; 08-25-2009 at 09:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •