Display related CPT with custom taxonomy

I was building something similar a couple of years ago, here’s what I did, maybe it helps … (changed to your use case) $result = new WP_Query([ ‘post_type’ => ‘location’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1, // all of them on one page ‘tax_query’ => [ [ ‘taxonomy’ => ‘services’, ‘field’ => … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)