The thing (wordpress) is how can I make wordpress to format in a specific way (diferent from others) posts related to a certain category (it was in loop-single right?)
Does anyone have a nice link about this?
THX!
You'll want to use WordPress' Category Templates. For example if you have a category named news you can create template file named category-news.php (make sure you have permalinks enabled) or you can use the category ID. From there modify the contents of the category-news.php using CSS classes or IDs to display the styling you want for the category.
Related
Hiall,
In my wordpress site I have a Category called “meetings”, and it’s slug is “meeting”, also its ID is 27.
I create a default post article and then select “Meeting” from the categories panel and then publish etc.
Reading here
http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display
If I create a template file called category-meetings.php or category-27.php then it should pick those files up and use them for a template layout for my selected Meeting category posts etc???
But for whatever reason I can not get it to do this.
I have also tried changing the permalinks settings from “post name” to custom structre with /%category%/%postname%/
but again no luck.
Am I missing something here?
Any help would be great!
I think you're trying to target a single post, whereas your template is targeting the category archive pages. For example, look at this diagram of the template hierarchy.
You could:
1) Create that post as a page and then create a template just for that page.
2) Create a custom post type and create a custom template for that custom post type.
The naming has to match your slug. I would change
category-meetings.php
to
category-meeting.php
And make sure the category-customname.php files are in the same directory as the default category.php file.
Addition/Revision
For a custom page for a single post -- find the post number, let's say 999, then create a single page with the past number appended to the file name in the same directory where the single.php file exists. This worked up to WP ver 3.2-ish. Unless it's been deprecated, it should still work.
single-999.php
I'm working on a Wordpress 3.4 project. I have categories and then several tags, and also one custom taxonomy as types.
Wordpress is fantastic as far as it handles all the taxonomy page, but I'm unable to figure out how to have pages where I have categories listing page (with pagination) specifically filtered to a selected tag or custom taxonomy.
So basically I want Categories, but then again, I also need to have a categories page with all posts filtered to specific tag, and then with pagination.
I have tried to figure out how to do that, but unable to find the exact doc or help. The issue is also with the URL, as how it will be formed?
Any idea how to fix that one, or any plugin to get this things done?
I think these two codex pages will help you along your way.
http://codex.wordpress.org/Class_Reference/WP_Query
and
http://codex.wordpress.org/images/1/18/Template_Hierarchy.png
You can use WP_Query to query posts based on tags and categories/custom taxonomies and much more.
If you look at the template hierarchy you'll see you can use special template files for tags and taxonomies too. Just remember to flush your permalinks if you're not seeing these templates being used if you create one.
As per the title,
I am using a accordion menu that displays my categories and sub categories.
If a category has any children i wish the results to be displayed using my modified archive.php. However if there are no children i wish for the post to be displayed on single.php.
many thanks in advance.
Simon
A while back I wrote a plugin called Category Template Hierarchy, it will easily let you accomplish what your trying to do by the fact that it lets you create templates specifically for templates that are parents.
It won't use archive.php, but it will allow you to create a template called parent-category.php. Anything that is not a parent will be ignored.
Additionally, the plugin gives you access to a conditional tag is_parent_category().
I have two categories that need a special template. Each has one post and will display differently. So I read that if the category is named, for example, 'testing' and the template name is 'testing.php' then it should use that correct?
Why would it not? I keep previewing the post and it just redirects to the home page.
Naming the template testing.php won't work. You need to use either a slug or ID of your category, so either category-testing.php or category-ID.php if you know the ID of category (ie. you're not making a theme for release and your IDs are constant).
Category templates, which your version of WordPress has, can do it.
What version of WordPress are you running. WordPress 3.0 is new and will support what you want out of the box as you described.
I am looking at using a custom template for a set of categories. Is it possible to use a category template (like category-4.php) on a parent category and have the children use that template as well?
So based on the answer so far, is there a way to accomplish this? I want to add text and images to all categories within a parent category.
From the documentation it does not appear to be possible without actually adding several category template files (unless you custom program it). I run Wordpress, and I have only seen it accomplished category by category.
http://codex.wordpress.org/Category_Templates