Again: add articles of a category to a page with the same title
I used this code
<?php $listCategory = get_the_title($post_id, 'the_category', true); ?> <?php query_posts( 'category_name=' . $listCategory ); ?>
to list all the articles of e.g. the category “Injuries” on the page named “Injuries”. Works great.
But: I use the german language. So I get some pages named with special characters like “Überraschung”. I have a category named “Überraschung” also. The slug shows in both cases the nicename “ueberraschungen”.
But the code above doesn’t get the match for these.
Now the slug shows “ueberraschung” as nicename for both, the page and the category. But the code above doesn’t result in the correct list. Instead it shows ALL articles of All categories.
How do I have to modify the code to match the page title with the category in these cases. Or maybe it would be better to look for a matchup beetween the nicename parts of the slug instead?
I tried desperately without getting there.
Any help is very much appreciated.
- The topic ‘Again: add articles of a category to a page with the same title’ is closed to new replies.