Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor empiresafe

    (@empiresafe)

    Just realized you don’t have a premium version of this plugin haha, I was confusing it with another plugin that I got this one to help with. If you throw this fix into the next update, I would love to give you a donation for your trouble if you have a link or Venmo!

    Plugin Contributor empiresafe

    (@empiresafe)

    Hi Marcel,

    I researched a little more on the .localecompare function going on here, and found out it was just as simple as adding some options! Simply replace the customtaxorder_asc_sort with

    function customtaxorder_asc_sort(a, b) {
    	return jQuery(a).text().localeCompare(jQuery(b).text(), undefined, {numeric: true, sensitivity: 'base'});
    }

    and it’s perfect! Can you please include this fix in future updates? I am buying the premium version of this plugin now that I have my issue permanently solved, thanks for the help!

    Please note that I took out the conversion to uppercase as the “base” setting here makes it redundant.

    • This reply was modified 8 years, 3 months ago by empiresafe.
    • This reply was modified 8 years, 3 months ago by empiresafe.
    Plugin Contributor empiresafe

    (@empiresafe)

    Hi Marcel,

    I came up with a solution that works for me for now. In script.js I changed the function customtaxorder_asc_sort being used as the custom sort function when customtaxorder_orderalpha() is called on the button press.

    // Ascending sort
    function customtaxorder_asc_sort(a, b) {
    	//return (jQuery(b).text()) < (jQuery(a).text()) ? 1 : -1;
    	//console.log (jQuery(a).text());
    	if (!isNaN(jQuery(a).text())) {
    		return jQuery(a).text()-jQuery(b).text();
    	} else {
    		return jQuery(a).text().toUpperCase().localeCompare(jQuery(b).text().toUpperCase());
    	}
    }

    This uses isNaN (not a number) to check if each value is a number before deciding which sorting algorithm to use. This solves my problem as my attributes are either numbers or letters but not both. I’m still a little unfamiliar with the .sort functionality, but I’m pretty sure this “solution” will break if it encounters attributes that are both numbers and letters.

    Plugin Contributor empiresafe

    (@empiresafe)

    I should also point out, this is nothing to do with the front end. This happens in the drag-and-drop screen when clicking “Sort Alphabetically”, see attached here another list of decimals that don’t get sorted correctly.
    0.41
    0.70
    0.90
    0.92
    0.94
    0.95
    1.36
    1.40
    1.43
    1.5
    1.57
    1.72
    1.75
    10
    10.00
    10.10
    10.42
    10.50
    10.59
    10.63
    10.65
    10.74
    10.94
    11.00
    11.11
    11.55
    11.67
    11.74
    12.09
    12.11
    12.20
    12.30
    12.31
    12.35
    12.40
    12.73
    12.96
    13.15
    13.18
    13.20
    13.24
    13.30
    13.89
    14.27
    14.33
    14.44
    14.47
    14.67
    14.75
    15.02
    15.04
    15.08
    15.28
    15.31
    15.42
    16.33
    16.63
    16.86
    17.04
    17.70
    18.13
    19.56
    2.06
    2.1
    2.10
    2.26
    2.27
    2.33
    2.34
    2.37
    2.43
    2.48
    2.78
    2.84
    2.87
    2.96
    20.37
    20.45
    21.10
    21.22
    22.25
    22.92
    23.10
    24.94
    25.53
    26.40
    26.67
    3.04
    3.1
    3.17
    3.2
    3.28
    3.30
    3.33
    3.55
    3.70
    3.80
    3.95
    33.54
    33.69
    36.58
    36.83
    39.49
    39.50
    4.00
    4.08
    4.14
    4.28
    4.33
    4.37
    4.4
    4.44
    4.52
    4.57
    4.66
    4.86
    4.87
    4.98
    41.56
    5.00
    5.39
    5.49
    5.56
    5.58
    5.73
    5.74
    5.75
    5.76
    5.93
    6.00
    6.09
    6.10
    6.21
    6.33
    6.35
    6.39
    6.54
    6.61
    6.62
    6.67
    6.75
    6.77
    6.82
    6.95
    7.08
    7.15
    7.29
    7.44
    7.59
    7.60
    7.62
    7.64
    7.70
    7.71
    7.74
    7.75
    7.82
    7.87
    7.91
    7.96
    7.97
    8.00
    8.04
    8.10
    8.19
    8.30
    8.33
    8.4
    8.43
    8.51
    8.52
    8.57
    8.67
    8.75
    8.82
    8.85
    8.89
    8.95
    8.97
    9.06
    9.16
    9.26
    9.44
    9.48
    9.85
    9.92

    Awesome to come to the support forum with my errors copied and ready to go, and then find the solution right in front. Worked for me, thanks!

    Thread Starter empiresafe

    (@empiresafe)

    For anybody looking through this post – I didn’t end up finding a way to hijack the pagination, I tried setting atts[‘columns’] (and atts[‘cols’]) but it seemed like nothing changed it. Instead, I’m using WP Mobile Detect that doesn’t load content based on the device. Now, my page is double size with a LOT of galleries and the Visual Editor runs very slowly on that page, but a desktop or phone user only downloads the 8 or 4 column galleries & images, rather than my original idea above of loading both and HIDING one or the other. Threw some [notphone] tags around the page, copied and pasted the whole thing, and then threw [phone] tags around the rest. Perfect!

Viewing 6 replies - 1 through 6 (of 6 total)