WordPress.org

Ready to get started?Download WordPress

Forums

Scroll Top and Bottom
[resolved] Alt and size attributes missing (7 posts)

  1. tizz
    Member
    Posted 2 years ago #

    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/

  2. shariarbd
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. tizz
    Member
    Posted 2 years ago #

    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
  4. tizz
    Member
    Posted 2 years ago #

    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=$(…
  5. shariarbd
    Member
    Plugin Author

    Posted 2 years ago #

    Oh, I am sorry... I did the mistake, Replace width="32px" height="32px" as width="32" height="32", hope it will work...

  6. shariarbd
    Member
    Plugin Author

    Posted 2 years ago #

    <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>
  7. tizz
    Member
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic