Support » Plugin: m1.DownloadList » Remove file extension from list

  • Resolved rwdrummond

    (@rwdrummondcoxnet)



    I have a desire to show the list of file names without the extensions, so I added another attribute called ‘noext’ that can be set to “1” to hide the extensions: [m1dll noext="1" ...]

    Here is the code change, in case you (or others) are interested. Thanks again for a very useful plugin!

    Original code (index.php line 192):

    $content.= '
        <li>
            <a href="'.$f['href'].'" class="test" style="background: url(\''. $f['bg-url'] .'\') left no-repeat; padding-left:20px;"'. $f['target'] .'>
            ' . $f['filename'] . '
            </a>
            '. (($atts['nosize']=="1")?'':$f['size']) .'
        </li>
        ';

    New code:

    $content.= '
        <li>
            <a href="'.$f['href'].'" class="test" style="background: url(\''. $f['bg-url'] .'\') left no-repeat; padding-left:20px;"'. $f['target'] .'>
            ' . (($atts['noext']=="1" && $f['type']="f")?str_replace(strtolower(substr($f['filename'], strrpos($f['filename'], "."))), '', $f['filename']):$f['filename']) . '
            </a>
            '. (($atts['nosize']=="1")?'':$f['size']) .'
        </li>
        ';

    https://wordpress.org/plugins/m1downloadlist/

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove file extension from list’ is closed to new replies.