Use the category name instead of category slug in permalinks

I did not test this, but this should do what you want. Put the following in your functions.php: add_filter(‘rewrite_rules_array’, ‘new_category_name_rewrite_rule’); function new_category_name_rewrite_rule($rules) { $new_rules = array(); $categories = get_categories(); foreach ($categories as $category) { $cat_name = preg_replace(‘#\s+#’, ‘-‘, $category->name); $new_rules[“https://wordpress.stackexchange.com/”.$category->slug.”https://wordpress.stackexchange.com/”] = “https://wordpress.stackexchange.com/”.urlencode($cat_name).”https://wordpress.stackexchange.com/”; } return $new_rules + $rules; }

Display posts from a category

You’re doing query_posts and then immediately get_posts. This looks wrong. Remove the query_posts call. Also, where does your $cat come from? It doesn’t appear to be set anywhere in your code snippet. Try to start with setting it first: $cat = get_query_var(‘cat’);

not all categories being displayed

I played with your code a little bit on my local WordPress. I think this should solve your problems. Arguments for your first get_categories call, should look like this: $args=array( ‘hide_empty’=>false, ‘orderby’ => ‘slug’, ‘order’ => ‘ASC’, //’include’ => ‘5, 6, 7, 8′, – you don’t need to include anything //’exclude’ => ‘3, 8, 9, … Read more

How can I only display one link rather than many?

Just use the break statement to abort after the first cat that is found and that is a child category. foreach ( get_the_category() as $cat ) { if ( cat_is_ancestor_of( 10, $cat ) ) { printf( ‘<a href=”https://wordpress.stackexchange.com/questions/103533/%s”>%s</a>’, get_category_link( $cat->cat_ID), echo $cat->cat_name ); break; } }