• Resolved bilal43

    (@bilal43)


    I am working on wordpress texonomies and there is already working texonomies but my texonomy that I want to add in it not working. I write the same code as existing texonomies used. Code is here…

    My texonomy that I want to use is post_tag: Function::::

    `function TaskerDev_create_post_type() {
    global $tasks_url_thing, $services_url_thing, $serv_list, $auction_thing_list, $tsk_list;

    $icn = get_bloginfo(‘template_url’) . “/images/taskicon.gif”;
    register_post_type(‘task’, array(
    ‘labels’ => array(
    ‘name’ => __(‘Tasks’, ‘TaskerDev’),
    ‘singular_name’ => __(‘Task’, ‘TaskerDev’),
    ‘add_new’ => __(‘Add New Task’, ‘TaskerDev’),
    ‘new_item’ => __(‘New Task’, ‘TaskerDev’),
    ‘edit_item’ => __(‘Edit Task’, ‘TaskerDev’),
    ‘add_new_item’ => __(‘Add New Task’, ‘TaskerDev’),
    ‘search_items’ => __(‘Search Tasks’, ‘TaskerDev’),
    ),
    ‘public’ => true,
    ‘menu_position’ => 5,
    ‘register_meta_box_cb’ => ‘TaskerDev_task_set_metaboxes’,
    ‘has_archive’ => $tsk_list,
    ‘rewrite’ => array(‘slug’ => $tasks_url_thing . “/%tasker_cat%”, ‘with_front’ => false),
    ‘supports’ => array(‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘comments’),
    ‘_builtin’ => false,
    ‘menu_icon’ => $icn,
    ‘publicly_queryable’ => true,
    ‘hierarchical’ => false

    )
    );

    //—————————————–

    $icn = get_bloginfo(‘template_url’) . “/images/serviceicon.gif”;
    register_post_type(‘service’, array(
    ‘labels’ => array(
    ‘name’ => __(‘Services’, ‘TaskerDev’),
    ‘singular_name’ => __(‘Service’, ‘TaskerDev’),
    ‘add_new’ => __(‘Add New Service’, ‘TaskerDev’),
    ‘new_item’ => __(‘New Service’, ‘TaskerDev’),
    ‘edit_item’ => __(‘Edit Service’, ‘TaskerDev’),
    ‘add_new_item’ => __(‘Add New Service’, ‘TaskerDev’),
    ‘search_items’ => __(‘Search Services’, ‘TaskerDev’),
    ),
    ‘public’ => true,
    ‘menu_position’ => 5,
    ‘register_meta_box_cb’ => ‘TaskerDev_service_set_metaboxes’,
    ‘has_archive’ => $serv_list,
    ‘rewrite’ => array(‘slug’ => $services_url_thing . “/%tasker_cat%”, ‘with_front’ => false),
    ‘supports’ => array(‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘comments’),
    ‘_builtin’ => false,
    ‘menu_icon’ => $icn,
    ‘publicly_queryable’ => true,
    ‘hierarchical’ => false

    )
    );

    global $category_url_link, $location_url_link, $tag;
    register_taxonomy(‘tasker_cat’, array(‘task’, ‘service’), array(‘hierarchical’ => true, ‘label’ => __(‘Categories’, ‘TaskerDev’), ‘rewrite’ => array(‘slug’ => $category_url_link, ‘with_front’ => false)));

    register_taxonomy(‘tasker_location’, array(‘task’, ‘service’), array(‘hierarchical’ => true, ‘label’ => __(‘Locations’, ‘TaskerDev’), ‘rewrite’ => array(‘slug’ => $location_url_link, ‘with_front’ => false)));

    register_taxonomy(‘tag’, ‘post’, array(‘multifaceted’ => true, ‘label’ => __(‘Locations’, ‘TaskerDev’),
    ‘rewrite’ => array(‘slug’ => “post_tag”, ‘with_front’ => false)));

    add_post_type_support(‘task’, ‘author’);
    add_post_type_support(‘service’, ‘author’);

    register_taxonomy_for_object_type(‘service’, ‘tags’);
    register_taxonomy_for_object_type(‘task’, ‘tags’);

    register_taxonomy_for_object_type(‘post_tag’, ‘tags’);
    flush_rewrite_rules();

  • The topic ‘All texonomies working fine except one in wordpress’ is closed to new replies.