Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1014152

    Hi dear Kriesi team,

    I need to order the displayed categories in masonry portfolio by slug.

    I tried the Plugin https://wordpress.org/plugins/taxonomy-terms-order/ and searched this forum https://kriesi.at/support/topic/sort-categorie-filter-by-slug-in-portfolio-masonry/
    This solution does not work for me. The plugin ignores parent categories. I need to use parent categories for further customization. To order the displayed categories by slug should be the cleanest solution.
    Is it possible to customize it?

    Thanks in advance for your help!

    Best regards, Thomas

    #1014369

    Hey Ink_Eye,

    You can try the advanced version of the plugin which supports hierarchical structures too: https://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-taxonomy-terms-order/

    It’s not really possible to change the sort order in a user friendly way by modifying the theme. You would need to modify following code in enfold\config-templatebuilder\avia-shortcodes\av-helper-masonry.php (line 240+)

    
    		//get the categories for each post and create a string that serves as classes so the javascript can sort by those classes
    		function sort_array($the_id)
    		{
    			$sort_classes 	= array("all_sort");
    			$item_terms 	= get_the_terms( $the_id, $this->atts['taxonomy']);
    
    			if(is_object($item_terms) || is_array($item_terms))
    			{
    				foreach ($item_terms as $term)
    				{
    					$term->slug = str_replace('%', '', $term->slug);
    					$sort_classes[] = $term->slug.'_sort ';
    				}
    			}
    
    			return $sort_classes;
    		}
    

    I.e. if you apply the sort() function ( http://php.net/manual/function.sort.php ) to the array the sort order would be alphabetical:

    
    		//get the categories for each post and create a string that serves as classes so the javascript can sort by those classes
    		function sort_array($the_id)
    		{
    			$sort_classes 	= array("all_sort");
    			$item_terms 	= get_the_terms( $the_id, $this->atts['taxonomy']);
    
    			if(is_object($item_terms) || is_array($item_terms))
    			{
    				foreach ($item_terms as $term)
    				{
    					$term->slug = str_replace('%', '', $term->slug);
    					$sort_classes[] = $term->slug.'_sort ';
    				}
    			}
    
    			sort($sort_classes);
    			return $sort_classes;
    		}
    

    Best regards,
    Peter

    #1014462

    Hey Dude,

    thank you for the hint with the Plugin. I bought it and it works fine.

    I tested the code before and got a strange result (video below). I made it undone but this strange wobbling stays. Maybe still in cache?

    Thank you, Dude!

    Best regards,
    Thomas

    #1014570

    Hey Dude,

    everything is fine now. Thank you for your help as always!

    Best regards,
    Thomas

    #1014576

    Hey!
    Great, glad it works now :)

    Best regards,
    Peter

    #1014777

    Hi Dude,

    ich schreibe mal gerade auf deutsch, ich hoffe, das ist in Ordnung. Die Masonryeinträge bewegen sich noch einmal so wie in dem gestern beigefügten Video. Ich kann mir leider nicht erklären, was das verursacht. Vielleicht hat das mit der Browserbreite zu tun.

    Hast du da vielleicht eine Idee?

    Liebe Grüße,
    Thomas

    #1015136

    Hey!

    Ich habe jetzt die Resize-Funktion in der child theme functions.php ein wenig angepasst, das Problem sollte nun behoben sein. Der neue Code ist:

    
    add_action('wp_footer', 'ava_auto_resize_masonry');
    function ava_auto_resize_masonry(){
    ?>
    <script>
    (function($){	
    	setTimeout(function(){
    		$(window).trigger('resize');
    		$(window).trigger('av-content-el-height-changed');
    	}, 3000);
    })(jQuery);
    </script>
    <?php
    }
    
    

    LG,
    Peter

    #1015161

    Hallo Peter,

    vielen Dank! Ich schaue mir das mal an.

    liebe Grüße,
    Thomas

    #1015175

    Hi Peter,

    danke für deine Arbeit und Hilfe! Es scheint mit der Bildschirmauflösung zu tun zu haben. Bei ca. 2500px wird das Masonry Element wie gewohnt dargestellt. An einem 4K Bildschirm bewegen sich auf der “Team” Seite die fünf dargestellten Personen beim Seitenaufruf nach rechts, dann wieder nach links. Habe gerade eine Bildschirmaufnahme davon gemacht.

    Mit Enfold arbeite ich nun seit fünf Jahren und bin überaus begeistert. Ich kann mir diese Darstellungen nur durch unsere Anpassungen in den letzten Tagen erklären. Die Theme Programmierung von Grund auf ist ja wunderbar.

    Vielleicht hast du da noch eine Idee, was das sein könnte.

    Liebe Grüße,
    Thomas

    #1015594

    Hi,

    Can you upload the video on youtube or vimeo? I can’t play the current format.
    It’s pretty rare or uncommon for users to have 4k screen resolution so I don’t think this is an urgent issue.

    Best regards,
    Ismael

    #1015603

    Good morning Ismael,

    I exported the video in the H264 Codec / mp4. I hope, that helps. Thank you!

    You are right. 4K is neither common, nor is this urgent to solve.

    Best regards,
    Thomas

    #1015611

    Hi,

    Ich habe den Wert der resize Animation (siehe Code von oben) jetzt auf 1500 reduziert, dadurch sollte es nach dem Ladedprozess nicht mehr “zittern”. Während des Ladeprozesses lässt es sich nicht verhindern, da durch die zusätzlichen Elemente (zB des “Read more” Buttons, welcher dynamisch eingefügt wird) die Breiten und Höhenwerte neu kalkuliert werden und dies zu einer Positionsveränderung führen kann.

    LG,
    Peter

    #1015615

    Hallo Peter,

    vielen Dank!

    Liebe Grüße,
    Thomas

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.