fweeeb
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Pages with CategoriesGlad to help!
Actually, as a correction to the above, it turns out you don’t really need to name your template “category-#.php”. You can call it anything you like and it will still work, although it may be good practice to name your templates like this.
Forum: Fixing WordPress
In reply to: Pages with CategoriesYou can do this without the use of plugins as I’ve just discovered. It almost seemed too easy, so I’ve got to test it further, but here goes…
Apologies if this is obvious:
– Create a new PHP template file for each category, named “category-#.php”(#=the preferred category number). Make sure it’s assignable by putting the Template Name at the top of the file.
– In the new template, insert the following query_posts line just before the loop, inserting the category name in place of ‘#’:
<?php query_posts('category_name=#'); ?>– Go and Edit the Page that you’d like to display posts in this category, eg ‘Events’, and assign it the relevant template you’ve just created.
– Make sure none of the pages you are going to assign as Category pages are selected as your ‘Posts Page’ in Settings > Reading.
– Go to Settings > Permalinks and insert
/%postname%/in Custom Structure field, then save changes. This will give you nice URLs, and not “/?cat=*”.Done! Now selecting the relevant Page (eg Events) in your main navigation will take you to a page showing all posts from the assigned category. Hope that works for other people…
Forum: Fixing WordPress
In reply to: Bug or “Feature”? “Posts” page won’t use custom page template…Thank you!