treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Wordpress: Problem with custom post type and taxonomy

  • Hi everyone,

    recently, I started working on my personal blog based on wordpress. I want to share my snippets with other people, so I created a page (snippets.php) that I use to list all the snippets. Moreover, I registered a custom post type called 'snippet' and added single-snippet.php to my theme folder. The page displaying all snippets works great, and so does the template responsible for displaying individual snippets.

    So now when I go to http://localhost/projects/my_wordpress/snippets/ I see all the snippets.

    When I click on one of them I go to e.g. http://localhost/projects/my_wordpress/snippets/border-radius

    Then I decided I'd like to register custom taxonomy so that I can group my snippets. I did it, but then I got stuck. At the very bottom of the page displaying a snippet I placed a link to a page displaying all the snippets from a given group. I created the link using

    <?php echo the_terms( $post->ID, 'language', $before = '', $sep = ', ', $after = '' ); ?>
    

    When I click the link I am redirected to: http://localhost/projects/my_wordpress/language/css/ but I see no posts displayed and WP uses index.php to display them (in fact it doesn't display them but it uses index.php). How can I change it so that WP uses taxonomy-language.php to display a list of all the snippets related to a given language?

    I hope you get what I mean :)

    Tomek