Display a list of random terms from custom taxonomy with shortcode

Try this code: function these_rand_tax1() { $max = 8; //number of categories to display $taxonomy = ‘baumaschinen_cat’; $terms = get_terms(‘taxonomy=’ . $taxonomy . ‘&orderby=name&order=ASC&hide_empty=0’); $terms = (array)$terms; // Random order shuffle($terms); // Get first $max items $terms = array_slice($terms, 0, $max); // Sort by name usort($terms, function ($a, $b) { return strcasecmp($a->name, $b->name); }); // … Read more

How to display an image before title text in menu items

You are almost there, see comments in code below… function wp3456789_wp_nav_menu_objects( $items, $args ) { foreach( $items as &$item ) { $image = get_field(‘icon’, $item); if( $image ) { // Your original code which appends html string to current $item->title //$item->title .= ‘<span class=”inline-img’ . $item->class . ‘”><img class=”style-svg” src=”‘ . $image[‘url’] . ‘” width=”” … Read more