WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pages Widget Validation Error with Kubrik theme (11 posts)

  1. ptp
    Member
    Posted 8 years ago #

    I'm loving the Sidebar Widgets plugin. I have only one problem, when I check for validation (the link for which isn't in the Meta when using a customized Sidebar anymore) I get the following validation error:

    Line 168, column 30: an attribute value must be a literal unless it contains only name characters .

    <li class="pagenav"><h2 class="widgettitle">Pages</h2>

    I've changed the order around to see if it was just a bug with the combination I had, I've removed all the other widgets, and still get the error, though the line changes around some. I've also tried with a custom title and without, with no difference.

    My blog is up at: http://blog.theburrowfamily.net
    A link to the validation of that blog is: Validation of Pneumonochrome

    Any ideas what I can do to fix this?

  2. bdsays
    Member
    Posted 8 years ago #

    Well it doesn't throw an error on my page. I use kubrick theme along with sidebar widgets as well.

    You might want to check your sidebar.php file again.

  3. ptp
    Member
    Posted 8 years ago #

    Hrmmm. Odd. I copied the sidebar file straight out of the plugin zip and haven't changed a thing.... okay, I'll keep playing with it.

    Edit: Nothing looks amiss in my sidebar.php file...

    Any other ideas? Does anyone else have validation erros?

    Edit #2: bdsays, it doesn't look like you have the "Pages" widget on your sidebar, at least, not if the site you're referring to is the one your name links too. It's only on the Pages widget that I see this problem. Sorry I didn't mention that in the first post... I thought I had.

  4. ptp
    Member
    Posted 8 years ago #

    Okay, after some more fiddling, this is what I've found:

    I edited the "widgets.php" plugin file at line 624 as follows:

    I commented out line 624, which was:
    wp_list_pages("title_li=$before_title$title$after_title");

    and added the following 3 lines:

    $testarg = $before_title . $title . $after_title;
    echo '<!--' . $testarg . '-->';
    wp_list_pages("title_li=$testarg");

    This result in an HTML comment that looks like:


    <!--<h2 class="widgettitle">My Pages</h2>
    -->

    and the line that's causing validation problems:


    <li class="pagenav"><h2 class=\"widgettitle\">My Pages</h2>

    So, it looks like the problematic slash is being inserted by the wp_list_pages() function somehow, as it's definitely not there in the comment.

    This is, unfortunately, the extent of my ability with PHP. I'm thinking this qualifies as a bug, but I don't know what to do from here. If anyone knows of an easy way to fix this problem, I'd be very grateful for tips.

  5. ptp
    Member
    Posted 8 years ago #

    I'm still stuck on this. Has anyone got any idea how I can get rid of those slashes? It looks like somewhere in the wp_list_pages function, the quotes we're feeding to it are getting escaped (notice that there's a / before both quotes in the <h2 class="widgettitle"> tag). I've examined the function in the wp-post-functions.php file, but I haven't found anything that jumps out at me. Granted, I don't understand every bit of code there, but at any rate, I'm stuck. I think I understand most of the code, except I don't know what __('Pages') is, so I don't know if that could be where it's coming from.

    Please help.

  6. ptp
    Member
    Posted 8 years ago #

    All right,

    It looks like no one is inclined to help. After a lot of research I've managed to apply a quick-and-dirty fix to get this validating again, the details are below:

    I replaced line 624 of widgets.php with four lines of code.
    624 was originally:

    wp_list_pages("title_li=$before_title$title$after_title");

    Changing it to:

    ob_start ();
    wp_list_pages("title_li=$before_title$title$after_title");
    $tempout = ob_get_clean ();
    echo stripslashes($tempout);

    This is obviously quick and dirty, because if there *were* any reason to have backslashes in that line of HTML, it would remove them indiscriminately. I've been unable, however, to get the replacement to work using preg_replace or str_replace. So, for anyone else who wants to use the widgets plugin with the Kubrick theme, wants to display their pages section on their dynamic sidebar, and wants their page to validate, the above code change in widgets.php should temporarily fix it.

  7. ptp
    Member
    Posted 8 years ago #

    Okay, sorry, I'm not really trying to bump this, I'm just trying to make sure that the solutions are here before I give up. After some searching, I found Ticket #2638, which addresses this issue. I've applied the code change recommended by the submitter, and it has taken care of the problems I was having in a much narrower scope than my initial fix suggestion. The ticket can be viewed at

    http://wordpress.org/support/topic/67267?replies=6

    I'm changing this to resolved.

  8. pielgrzym
    Member
    Posted 8 years ago #

    Where to apply the fix given in the following link:

    http://trac.wordpress.org/ticket/2638

    ??

    I've searched all over widgets.php and haven't found proper lines :(((

    EDIT: I've found the proper file:

    wp-includes/template-functions-post.php

    sorry for troubling ;)

  9. Stahn
    Member
    Posted 8 years ago #

    Thank you so much for this, I have the same problem, I think it should be included NOW on the widgets default zip.

  10. pielgrzym
    Member
    Posted 8 years ago #

    The problem lies in the internal Word Press function :) thankfully it was so easy to solve :)

  11. pielgrzym
    Member
    Posted 8 years ago #

    Warning: this bug hasn't been fixed in WP 2.0.3, so after upgrading you need to apply the changes to wp-includes/template-functions-post.php again. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags