taxonomy template help
I am pulling my hair out trying to create a custom taxonomy template and am hoping someone here can tell me what I am missing.
I am using the twentytwelve theme.
I want to add a custom taxonomy for Locations. I’ve done this using this tutorial from Smashing Magazine. http://wp.smashingmagazine.com/2012/01/04/create-custom-taxonomies-wordpress/
Now, I want to create archive pages. If a visitor clicks on domain.com/locations/california, it should show the archive for all posts with that taxonomy.
I followed the next step in the tutorial and created taxonomy-locations.php. The file includes the following code:
get_header(); $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
At first, I copied and pasted the smashing mag code, but this didn’t work. Instead of showing posts in “california”, it simply showed my most recent posts.
I’ve looked at a dozen other tutorials and attempted a dozen other taxonomy-locations.php files, but nothing works. I cannot get the archive pages to show.
Am I missing something? Is there an extra step I need to take? Like creating another page or template? Is this an issue with the twentytwelve theme itself?
Here is the site I’m working on… http://www.testingbaret.com/locations/east-bay/ (shows index.php)
http://www.testingbaret.com/locations/east-bay/danville (shows a random post with the word “danville” in it. No idea how this is happening)
I’ve also tried naming the file locations.php and that makes no difference.
- The topic ‘taxonomy template help’ is closed to new replies.