The MU forums have moved to WordPress.org

Preview broken for some themes in 2.7.1 (19 posts)

  1. kgraeme
    Member
    Posted 15 years ago #

    Testing out 2.7.1 and I'm seeing that some of my themes aren't showing their preview when selecting them in the dashboard. Some do, some don't. If I activate the theme, the site loads fine and has the new theme.

    Is anyone else seeing this? I haven't dug in yet to see what's in the themes that might trigger it for some and not others.

    Some samples:

    Broken preview: Almost Spring, WP-Andreas01

    Working preview: Benevolence, Blix, Kubrick

  2. tdjcbe
    Member
    Posted 15 years ago #

    Not in a position to check but when you say "not showing", does that mean nothing at all is showing or it's partly broken and bits are missing or something else?

  3. andrea_r
    Moderator
    Posted 15 years ago #

    Or do you mean the screenshots aren't showing, or when clicking and getting the preview it's not showing?

  4. kgraeme
    Member
    Posted 15 years ago #

    The preview box appears but it displays a big white blank for where the site should be.

    Just to be clear, this is the preview when you click on a theme thumbnail. The thumbnails are showing up fine.

  5. Nimwit
    Member
    Posted 15 years ago #

    I have had a few wierd events where I changed the screenshot then refreshed the page (browser was emptied) and the old screenshot was still there until I refreshed again. Also using v2.7.1 beta.

    N.

  6. kgraeme
    Member
    Posted 15 years ago #

    Refreshing doesn't do anything.

    Using Firebug and looking at the generated iframe content for the preview, for the ones that work it has the full site html in the iframe. In the ones that are blank, the content in the iframe looks like:

    <iframe id="TB_iframeContent" frameborder="0" style="width: 1149px; height: 348px;" onload="tb_showIframe()" name="TB_iframeContent266" src="http://my.site.com/kgraeme/?preview=1&amp;template=almost-spring&amp;stylesheet=almost-spring&amp;" hspace="0">
        <html>
            <head/>
            <body/>
        </html>
    </iframe>

    Strangely blank HTML.

  7. hotohori8899
    Member
    Posted 15 years ago #

    I had the same problem. I found an old post mentioning about removing special characters from theme's directory name (ie. "almost-spring" change to "almostspring"). I tried and it worked.

    Funny that i do not have this problem in 2.7 and judging from this post's response, I don't think everyone had this issue. Hmm...

  8. kgraeme
    Member
    Posted 15 years ago #

    Yep, you're right. Every theme with the problem has a dash in the directory name.

    Changing the directory names is not high on my preferred solutions for this since it will break any sites using that theme.

    You don't happen to have a link to the old post, do you? Wondering if there was some discussion about what in the core was causing this.

  9. andrea_r
    Moderator
    Posted 15 years ago #

    Mmmm.. no discussion as I can remember.

  10. kgraeme
    Member
    Posted 15 years ago #

    Well this is interesting. I used svn from automattic to check out the 2.7.1 code to my test site.

    In the function preview_theme in /wp-includes/theme.php, the svn version I have differs from the ftp version and trac.

    My version (2.7.1 from svn) /wp-includes/theme.php

    489 | $_GET[template] = preg_replace('|[^a-z0-9_.-]|i', '', $_GET[template]);

    FTP/Trac /tags/2.7.1/wp-includes/theme.php

    852 | $_GET['template'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['template']);

    Trac /trunk/wp-includes/theme.php

    852 | $_GET['template'] = preg_replace('|[^a-z0-9_.-]|i', '', $_GET['template']);

    Note the missing "/" in the regex after the "-" in my version and in trunk.

    Is it normal that the SVN tagged version of files are different than the FTP/Trac version? My SVN version doesn't even have comments.

  11. hotohori8899
    Member
    Posted 15 years ago #

    This is the post...
    http://mu.wordpress.org/forums/topic.php?id=10485

    Well, actually the gentlemen was having problem because he had sub folders to contain the themes directories. But he mentioned there were reports of regular wp were fixed by removing special characters. So I tried my luck. :)

  12. kgraeme
    Member
    Posted 15 years ago #

    Sorta fixed.

    http://core.trac.wordpress.org/changeset/10677

    That change to the regex lines fixes the bug with hyphens in the folder names for me.

    Anyone have any idea why it was in the 2.7 branch and not included in 2.7.1 release? Is it doing something that was deemed not good?

    Edit: Looks like there have been several tickets on it.
    http://core.trac.wordpress.org/ticket/9619
    http://core.trac.wordpress.org/ticket/9329
    http://core.trac.wordpress.org/ticket/9244

    And I guess this is now the preferred fix to be included in 2.8:
    http://core.trac.wordpress.org/attachment/ticket/9244/less_confusing.9244.diff

    Time to modify the core until this gets incorporated I guess.

  13. andrea_r
    Moderator
    Posted 15 years ago #

    Might wanna bring it up in a trac ticket.

  14. kgraeme
    Member
    Posted 15 years ago #

    See my edit

  15. Konstan
    Member
    Posted 15 years ago #

    http://core.trac.wordpress.org/changeset/10677 fixed this for me.

    Thanks for showing the changeset :D

  16. kgraeme
    Member
    Posted 14 years ago #

    Props go to Denis-de-Bernardy, chrisbliss18, wpus.org, and filosofo. I just found the existing tickets, none are mine.

  17. aedapp
    Member
    Posted 14 years ago #

    Thanks. That pesky escaping is always troublesome.
    But question is, why was this not put into the 2.71 wpmu release?

  18. andrea_r
    Moderator
    Posted 14 years ago #

    Likely it hasn't been merged in yet.

  19. MAVIC
    Member
    Posted 14 years ago #

    Strange. I made the change as noted in the trac but it didn't solve the issue.

About this Topic