Françoise Wauters

Categories

There is no need to use categories in WordPress but putting Posts in categories can be very useful as a way to organise the website. If a Post is not put in a category it normally goes by default in a default category called 'Uncategorised'. This website has no such category because I deleted it and created instead a new category named 'Category Uncategorised'.

Now see admin Settings / Permalink Settings / Custom Structure where the custom structure is /%category%/%postname%. It could also be just /%postname% but isn't. In URL terms, adding /%category%/ to the permalink structure means the name (slug) of the category a Post is in is included in the web address. This Post for instance included 'patrick' in the URL because it's in the 'Patrick' category. There is no subfolder named 'patrick' but it's as if there is and that's fine.

But this is just the URL. So I created a template with Template Name: Category. It's a file named category.php and is part of the Theme. WordPress then uses this template automatically. The template generates a list of Posts in any category but only one at a time. The list has the CSS class "listing" which, according to the CSS rules for the 'listing' class, presents the list in the way I designed it to look. It can be changed as desired by manually editing category.php.

An important point to note about this is that every Post has at the bottom a link to its category. I think this is good as a way to navigate around. The link is hard-coded into category.php. Do what you want obviously. This is just the way I set things up so you are not stuck with it. You are only stuck with it if you rely on Google having indexed a page with the category name as part of the URL or if other websites link to it.

Note that francoisetaylor.com was set up differently from the beginning and has only /%postname% in the permalink structure. I did that because it didn't seem as if there were any obvious category names for the website that I would then be stuck with. It means there is no link to a category at the bottom of each Post as there is here. The main thing is decide from the start then don't switch from one to the other later on without a very good reason.


WordPress Pages are different to Posts. Pages don't go into categories like Posts do but are freestanding with no category name in the URL.

Filedate: February 7th, 2025

Leave a comment