• Sorry… me again. I dunno if I just missed it, looking through the documentation, but is it possible to group letters together. For example, grouping UV and WXYZ as single sections for better spacing when using Responsive.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author tugbucket

    (@tugbucket)

    hmmm… nothing out of the box for sure for this.

    add class="groupem" as an option to your shortcode.

    Now add this to your .js file in your theme.

    	function groupem(list){
    		var result = list.split(',');
    		htm = '';
    		jQuery.each(result, function(i){
    			html = jQuery('.groupem h4[id$="-'+result[i]+'"]').next('ul.links').html();
    			if(typeof html != 'undefined'){
    				htm += html;
    			}
    			if(i != 0){
    				jQuery('.groupem h4[id$="-'+result[i]+'"]').parent('div.tagindex').remove();
    			}
    		});
    		jQuery('.groupem h4[id$="-'+result[0]+'"]').text(result[0]+'-'+result.slice(-1)[0]);
    		jQuery('.groupem h4[id$="-'+result[0]+'"]').next('ul.links').html(htm);
    		
    		jQuery('#mcTagMap.groupem').each(function(){
    			jQuery('a', this).css({'color':'red'});
    		});
    	}
    	groupem('F,G,H');
    	groupem('U,V,W,X');

    notice the groupem('F,G,H'); function call. You put the letters you want to group in order here so like A,B,C,D or Q,R,S etc… and note they are capitalized and comma separated.

    Also, nothing has been done to group navigation items which you are not doing anyways and this won’t work with multipage either but again, you’re not doing that so this will hopefully work with the shortcode you are using after adding the class option like I said above.

    I tested this a little and it appears to work. Try it and let me know.

    • This reply was modified 7 years, 3 months ago by tugbucket.
    Plugin Author tugbucket

    (@tugbucket)

    oops, left a test line in there. Use the below:

    	function groupem(list){
    		var result = list.split(',');
    		htm = '';
    		jQuery.each(result, function(i){
    			html = jQuery('.groupem h4[id$="-'+result[i]+'"]').next('ul.links').html();
    			if(typeof html != 'undefined'){
    				htm += html;
    			}
    			if(i != 0){
    				jQuery('.groupem h4[id$="-'+result[i]+'"]').parent('div.tagindex').remove();
    			}
    		});
    		jQuery('.groupem h4[id$="-'+result[0]+'"]').text(result[0]+'-'+result.slice(-1)[0]);
    		jQuery('.groupem h4[id$="-'+result[0]+'"]').next('ul.links').html(htm);
    		
    	}
    	groupem('F,G,H');
    	groupem('U,V,W,X,Y,Z');
    Thread Starter hanxa

    (@hanxa)

    Thank you for the fast response! Did not expect you to go beyond on this one (so sending all the appreciation and metaphorical mars bars!!!)

    I added the shortcode, but am having issues with the script. Probably because I am useless at this thing (I self-taught html and css through trial and error so… :ironic-thumbs-up:) I am using Flash, so found the flash.js file in the editor and tried to add it to the end… guessing that was wrong because it didn’t work. I reverted and tried some of the other files but really banging my head against a wall.

    I do not expect any further help on this one; I feel like I have imposed enough and you’ve taken the time to respond. Gonna try and wrap my head around javascript and will let you know if I manage to work it out.

    So… basically wanted to say thank you, you are amazing, and I really appreciate the help 🙂

    Plugin Author tugbucket

    (@tugbucket)

    Well that theme doesn’t load flash.js. It loads flash.min.js. So you would need to add it in that file. Find:
    jQuery(document).ready(function(){function a(a){

    and put it here:

    jQuery(document).ready(function(){<HERE>function a(a){

    but I wouldn’t do that because if you update your theme, it’s gone. You really should be using a child theme so you can make edits like that.

    If you follow the instructions: https://ww.wp.xz.cn/plugins/multi-column-tag-map/#installation you can make a folder in your theme, copy mctagmap.js into that theme and add the above JS.

    Or, on the page in your admin, if you are using the table layout thing that Flash has, you can add a new row, click the source code button and between the short code put the JS code. You will need to wrap it in <script></script>. I did it locally and it seemed to work. This approach is hacky and easy to mess up, erase etc…

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

The topic ‘Grouping letters’ is closed to new replies.