WordPress.org

Ready to get started?Download WordPress

Forums

Download Monitor
[resolved] [download_page] Only Shows 1 Tag on Main Page (Bug) (2 posts)

  1. wfunderberg
    Member
    Posted 2 years ago #

    The other day I noticed that only 1 tag would show on the main page when using the [download_page] shortcode.

    After a bit of code researching I have found the problem and have corrected it. For those experiencing the same issue the fix is:

    1. Open the download-monitor-page.addon.php in any editor.

    2. Go to line 769 or search for:

    $sized_tags = array_slice($sized_tags, 0, $show_tags);

    3. Remove the "$show_tags" variable so it should read:

    $sized_tags = array_slice($sized_tags, 0);

    4. Save and refresh the page.

    I believe the $show_tags variable was put in place accidentally as that variable will either contain a 0 or 1. With that variable being placed in the array_slice function it is telling the function to only display 1. Ref: http://php.net/manual/en/function.array-slice.php

    http://wordpress.org/extend/plugins/download-monitor/

  2. colingreig
    Member
    Posted 1 year ago #

    Thanks for the fix, it worked for me.

    Unfortunately it started listing every single tag (400+ for me) so I added in some basic code to only show tags that were utilized more than 3 times.

    foreach ($sized_tags as $tag=>$count) {
    							// only show tags used more than twice
    							if($count > 3) {
    
    								$size = 80 + (($max-($max-($count-$min)))*$multiplier);
    								$page .= '<li style="font-size:'.$size.'%"><a href="'.wp_dlmp_append_url('dltag='.urlencode(strtolower($tag))).'">'.$tag.'</a>';
    
    							}
    						}

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic