jrodgers
Member
Posted 3 years ago #
I made a category page, category-5.php using the following steps,
copy index.php and renamed as category-5.php
how can i have a page link point to that without hard coding the link?
ie;
i have a page called my stuff, and a category called my stuff (category 5), when someone clicks on the page link in my menu i want it to show only the items from category my stuff
i tried setting the page template as category-5 (i added the php block to the top of the page that identifies page template)
jrodgers
Member
Posted 3 years ago #
sigotratando
Member
Posted 2 years ago #
Hi MichaelH,
I went to the FAQ you describe, but the topic was about linking to pages, not category templates.
I have visited http://codex.wordpress.org/Template_Hierarchy, under Examples, and tried following those instructions. For instance, you reach the blog by doing to http://www.domain.com/news I have a category template called category-press-releases.php. According to these instructions, the href to the category page should be:
http://www.domain.com/news/press-releases. But that does not work. Next I tried
http://www.domain.com/news/category-press-releases.php, and that did not work. Next I tried
http://www.domain.com/news/?cat=9. That took me to archives for that category, but not the category page template. So, I'm with jrogers: I still don't know how to link to a category template.
I'm seriously frustrated and could use any advice you can offer.
Thanks!
sigotratando
Member
Posted 2 years ago #
Oh, one other link I tried:
http://www.domain.com/news/category/press-releases.
You template needs to have the category ID--example: category-6.php
The category slug doesn't work until version 2.9.