WordPress.org

Support

Support » Plugins and Hacks » Scroll Top and Bottom » [Resolved] [Plugin: Scroll Top and Bottom] Alt and size attributes missing

[Resolved] [Plugin: Scroll Top and Bottom] Alt and size attributes missing

  • Hey, I like the new plugin version, but I’ve got two little problems.
    I was HTML 5 validated, but now I have two errors from the shown arrow buttons, because they don’t have alt text.
    Then, I got penalty in GTmetrix performance because images dimensions are missing as well.
    Can someone please tell me how can I put these values in PHP, or if the author will ever think about putting them in the next release?
    I guess I’ll have to change this line for my two buttons:

    <?php echo '<img src="' .plugins_url( ''.$icondr.'11_u.ico' , dirname(__FILE__) ). '" > '; echo '<img src="' .plugins_url( ''.$icondr.'11_d.ico' , dirname(__FILE__) ). '" > '; ?>

    Otherwise, is there any way to put alt text and dimensions over all images available (in case of buttons display change)?

    Thanks

    http://wordpress.org/extend/plugins/scroll-top-and-bottom/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Md Shariar Sarkar

    @shariarbd

    open the file …/scroll-top-and-bottom/tandb.php of version 2.0 and replace line Replace line 7 to 12 by the following code

    [ Edited. Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <div style="display:none;" class="nav_up" id="nav_up">
             <?php echo '<img alt="↑" width="32px" height="32px" src="' .plugins_url( 'scroll-top-and-bottom/icon/'.$wp_STAB_icon_Select.'_u.ico' , dirname(__FILE__) ). '" > '; ?>
              </div>
    		<div style="display:none;" class="nav_down" id="nav_down">
             <?php echo '<img alt="↓" width="32px" height="32px" src="' .plugins_url( 'scroll-top-and-bottom/icon/'.$wp_STAB_icon_Select.'_d.ico' , dirname(__FILE__) ). '" > '; ?>
            </div>

    I have been updated the file on the current version.

    Thanks for your reply.
    Sorry, it doesn’t work. I put your exact code in tandb.php (“up” and “down” in place of arrows).
    I have the same two errors in HTML5 validator:
    An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.

    …/scroll-top-and-bottom/icon/11_u.ico" ></div><div style="display:none;" class=…

    …/scroll-top-and-bottom/icon/11_d.ico" ></div><script>$(function(){var $elem=$(…

    (I think these lines are in stab.php)

    and the same two in GtMetrix results:

    The following image(s) are missing width and/or height attributes.

    http://www.mywebsite/wp-content/plugins/scroll-top-and-bottom/icon/11_d.ico
    http://www.mywebsite/wp-content/plugins/scroll-top-and-bottom/icon/11_u.ico

    Sorry, a quick update.
    I have W3total cache, so I have now empty all caches.
    No more GTmetrix errors (image dimensions), but now in validator there are 4 errors:

    Bad value 32px for attribute width on element img: Expected a digit but saw p instead

    /scroll-top-and-bottom/icon/11_u.ico" ></div><div style="display:none;" class=…
    
    Syntax of non-negative integer:
        One or more digits (0–9). For example: 42 and 0 are valid, but -273 is not. 
    
    …/scroll-top-and-bottom/icon/11_u.ico" ></div><div style="display:none;" class=…
    
    Syntax of non-negative integer:
        One or more digits (0–9). For example: 42 and 0 are valid, but -273 is not. 
    
    …/scroll-top-and-bottom/icon/11_d.ico" ></div><script>$(function(){var $elem=$(…
    
    Syntax of non-negative integer:
        One or more digits (0–9). For example: 42 and 0 are valid, but -273 is not. 
    
    …/scroll-top-and-bottom/icon/11_d.ico" ></div><script>$(function(){var $elem=$(…
    Plugin Author Md Shariar Sarkar

    @shariarbd

    Oh, I am sorry… I did the mistake, Replace width=”32px” height=”32px” as width=”32″ height=”32″, hope it will work…

    Plugin Author Md Shariar Sarkar

    @shariarbd

    <div style="display:none;" class="nav_up" id="nav_up">
             <?php echo '<img alt="&uarr;" width="32" height="32" src="' .plugins_url( 'scroll-top-and-bottom/icon/'.$wp_STAB_icon_Select.'_u.ico' , dirname(__FILE__) ). '" > '; ?>
            </div>
    		<div style="display:none;" class="nav_down" id="nav_down">
             <?php echo '<img alt="&darr;" width="32" height="32" src="' .plugins_url( 'scroll-top-and-bottom/icon/'.$wp_STAB_icon_Select.'_d.ico' , dirname(__FILE__) ). '" > '; ?>
            </div>

    Sure, to these last errors I could even get there by myself, but laziness won…
    Thank you very much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Plugin: Scroll Top and Bottom] Alt and size attributes missing’ is closed to new replies.
Skip to toolbar