Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to create a template for custom taxonomy ?


  • wpman
    Participant

    @iwpman

    I have a taxonomy:location
    I try to copy taxonomy-topic-tag.php ,then rename taxonomy-location.php .Layout displayed correctly but filtering topic not correctly.For instance:
    When I type http://www.domain.com/forums/location/school. It will display all topic of location.It doesn’t filter topic for school. Which php file I should edit ?Is there any easily alternate method to create a template for custom taxonomy?

Viewing 3 replies - 1 through 3 (of 3 total)

  • wpman
    Participant

    @iwpman

    sorry, it will display all topic.It doesn’t filter topic.


    Robkk
    Moderator

    @robkk

    That template taxonomy-topic-tag.php should be in the root of your theme, you can try that with your custom theme.

    I am not sure what else to suggest as this is custom development. You might need to study how topic-tag is used in bbPress possibly.


    amandainjames
    Participant

    @amandainjames

    I will suggest you to go through a WordPress custom taxonomy tutorial. Here are three steps to create a custom taxonomies in WordPress. To create a custom taxonomy you have to add this code in functions.php

    add_action( 'init', 'create_cw_hierarchical_taxonomy', 0 );
    //create a custom taxonomy name
    function create_cw_hierarchical_taxonomy() {
    $labels = array(
    'name' => _x( 'Topics', 'taxonomy general name' ),
    'singular_name' => _x( 'Topic', 'taxonomy singular name' ),
    'search_items' => __( 'Search Topics' ),
    'all_items' => __( 'All Topics' ),
    'parent_item' => __( 'Parent Topic' ),
    'parent_item_colon' => __( 'Parent Topic:' ),
    'edit_item' => __( 'Edit Topic' ),
    'update_item' => __( 'Update Topic' ),
    'add_new_item' => __( 'Add New Topic' ),
    'new_item_name' => __( 'New Topic Name' ),
    'menu_name' => __( 'Topics' ),
    );
    // taxonomy register
    register_taxonomy('topics',array('post'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'topic' ),
    ));
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar