Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom Taxonomy based on theme 'Captivate' WordPress

  • SOLVED

Hi,

I am using the captivate theme I purchased on Themeforest. I have added an additional Taxonomy to this theme called teams with the goal to have team members assigned to work projects. I've been able to create the taxonomy to a stage where I can add team members/ team categories. I've been attempting to use the structure of the work taxonomy page to shoe data related to the team members but cannot make this work. I have placed the site on a staging area at www.danielquinn.ie/rach and i'm using the sample data from the theme author.

What I Need

Guidance on how I should correctly add and configure the team taxonomy, and instruction on how I can relate team members to works.

I will give FTP access to the site...

Answers (3)

2013-05-27

Arnav Joy answers:

can you clear your question more , please


Daniel Q comments:

Hi Arnov,

Sure. I am using the captivate theme I purchased on Themeforest. This theme has a custom taxonomy called Works. I wiah to add a new taxonomy to this theme called 'Team'. I want to be able to list out my team members per category, much the same as works is displayed [[LINK href="http://www.danielquinn.ie/brady/work/"]]Here[[/LINK]]

I am having problems with the creation of this taxonomy with this theme. To explain, I have added the Taxonomy via this themes /framework/azure_registers.php file

This file appears as

<?php

if ( !isset($content_width) ) {
$content_width = 960;
}
if ( function_exists('add_theme_support') ) {
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'nav_menus' );
add_theme_support( 'custom-header' );
add_theme_support( 'custom-background' );
add_theme_support( 'post-formats', array( 'gallery', 'quote', 'video' ) );
}
add_editor_style();


/*******************************************************************
Register Menu
********************************************************************/
if ( function_exists('register_nav_menus') )
{
register_nav_menus(
array(
'primary' => __('Primary Menu', 'azurethemes'),
'secondary' => __('Secondary Menu', 'azurethemes')
)
);
}


/*******************************************************************
Register Sidebar
********************************************************************/
if ( function_exists('register_sidebar') )
{
$sidebar1 = array(
'Default',
'Footer Column 1',
'Footer Column 2',
'Footer Column 3',
'Footer Column 4'
);

$sidebar2 = azure_option('sidebar');

$sidebars = array_merge( (array)$sidebar1, (array)$sidebar2);
$sidebars = array_filter($sidebars);

foreach ($sidebars as $sidebar)
{
register_sidebar(array(
'name' => $sidebar,
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3 class="widget-title"><span>',
'after_title' => '</span></h3>',
));
}
}


/*******************************************************************
Register Post Type
********************************************************************/
add_action('init', 'work_post_type');
add_action('init', 'team_post_type');
add_action('init', 'faq_post_type');
add_action('init', 'slider_post_type');

function work_post_type()
{
$labels = array(
'name' => _x('Works', 'post type general name', 'azurethemes'),
'singular_name' => _x('Work', 'post type singular name', 'azurethemes'),
'add_new' => _x('Add New', 'work', 'azurethemes'),
'add_new_item' => __('Add New Work', 'azurethemes'),
'edit_item' => __('Edit Work', 'azurethemes'),
'new_item' => __('New Work', 'azurethemes'),
'all_items' => __('All Works', 'azurethemes'),
'view_item' => __('View Work', 'azurethemes'),
'search_items' => __('Search Work', 'azurethemes'),
'not_found' => __('No Work Found', 'azurethemes'),
'not_found_in_trash' => __('No Work Found in Trash', 'azurethemes'),
'parent_item_colon' => ''
);

$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'work-view', 'with_front' => true),
'query_var' => true,
'show_in_nav_menus'=> false,
'supports' => array('title', 'editor')
);

register_post_type( 'work' , $args );

register_taxonomy('work-category',
array('work'),
array(
'hierarchical' => true,
'label' => 'Work Categories',
'singular_label' => 'Work Categories',
'rewrite' => true,
'query_var' => true
));
}

function team_post_type()
{
$labels = array(
'name' => _x('Team', 'post type general name', 'azurethemes'),
'singular_name' => _x('Team', 'post type singular name', 'azurethemes'),
'add_new' => _x('Add New', 'team member', 'azurethemes'),
'add_new_item' => __('Add New Team Member', 'azurethemes'),
'edit_item' => __('Edit Team Member', 'azurethemes'),
'new_item' => __('New Team Member', 'azurethemes'),
'all_items' => __('All Team', 'azurethemes'),
'view_item' => __('View Team', 'azurethemes'),
'search_items' => __('Search Team', 'azurethemes'),
'not_found' => __('No Team Found', 'azurethemes'),
'not_found_in_trash' => __('No Team Found in Trash', 'azurethemes'),
'parent_item_colon' => ''
);

$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'team-view', 'with_front' => true),
'query_var' => true,
'show_in_nav_menus'=> false,
'supports' => array('title', 'editor')
);

register_post_type( 'team' , $args );

register_taxonomy('team-category',
array('team'),
array(
'hierarchical' => true,
'label' => 'Team Categories',
'singular_label' => 'Team Categories',
'rewrite' => true,
'query_var' => true
));
}

function faq_post_type()
{
$labels = array(
'name' => _x('FAQs', 'post type general name', 'azurethemes'),
'singular_name' => _x('FAQ', 'post type singular name', 'azurethemes'),
'add_new' => _x('Add New', 'FAQ', 'azurethemes'),
'add_new_item' => __('Add New FAQ', 'azurethemes'),
'edit_item' => __('Edit FAQ', 'azurethemes'),
'new_item' => __('New FAQ', 'azurethemes'),
'all_items' => __('All FAQs', 'azurethemes'),
'view_item' => __('View FAQ', 'azurethemes'),
'search_items' => __('Search FAQ', 'azurethemes'),
'not_found' => __('No FAQ Found', 'azurethemes'),
'not_found_in_trash' => __('No FAQ Found in Trash', 'azurethemes'),
'parent_item_colon' => ''
);

$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'faq-view', 'with_front' => true),
'query_var' => true,
'show_in_nav_menus'=> false,
'supports' => array('title', 'editor', 'page-attributes')
);

register_post_type( 'faq' , $args );

register_taxonomy('faq-category',
array('faq'),
array(
'hierarchical' => true,
'label' => 'FAQ Categories',
'singular_label' => 'FAQ Categories',
'rewrite' => true,
'query_var' => true
));
}

function slider_post_type()
{
$labels = array(
'name' => _x('Sliders', 'post type general name', 'azurethemes'),
'singular_name' => _x('Slider', 'post type singular name', 'azurethemes'),
'add_new' => _x('Add New', 'Slider', 'azurethemes'),
'add_new_item' => __('Add New Slider', 'azurethemes'),
'edit_item' => __('Edit Slider', 'azurethemes'),
'new_item' => __('New Slider', 'azurethemes'),
'all_items' => __('All Sliders', 'azurethemes'),
'view_item' => __('View Slider', 'azurethemes'),
'search_items' => __('Search FAQ', 'azurethemes'),
'not_found' => __('No Slider Found', 'azurethemes'),
'not_found_in_trash' => __('No Slider Found in Trash', 'azurethemes'),
'parent_item_colon' => ''
);

$args = array(
'labels' => $labels,
'public' => false,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'slider-view', 'with_front' => true),
'query_var' => true,
'show_in_nav_menus'=> false,
'supports' => array('title')
);

register_post_type( 'slider' , $args );
}


/*******************************************************************
Manage Columns
********************************************************************/
add_filter('manage_edit-work_columns', 'work_edit_columns');
add_filter('manage_edit-team_columns', 'team_edit_columns');
add_filter('manage_edit-faq_columns', 'faq_edit_columns');
add_action('manage_posts_custom_column', 'posts_custom_columns', 10, 2);

function work_edit_columns($columns)
{
$newcolumns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Title',
'work-category' => 'Categories'
);

$columns= array_merge($newcolumns, $columns);

return $columns;
}

function team_edit_columns($columns)
{
$newcolumns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Title',
'team-category' => 'Categories'
);

$columns= array_merge($newcolumns, $columns);

return $columns;
}

function faq_edit_columns($columns)
{
$newcolumns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Title',
'faq-category' => 'Categories'
);

$columns= array_merge($newcolumns, $columns);

return $columns;
}

function posts_custom_columns($column)
{
global $post;

switch ($column) {
case 'work-category':
echo get_the_term_list($post->ID, 'work-category', '', ', ','');
break;
case 'team-category':
echo get_the_term_list($post->ID, 'team-category', '', ', ','');
break;
case 'faq-category':
echo get_the_term_list($post->ID, 'faq-category', '', ', ','');
break;
}
}


/*******************************************************************
Register Meta Box
********************************************************************/
add_filter( 'cmb_meta_boxes', 'global_metaboxes' );
add_filter( 'cmb_meta_boxes', 'blog_metaboxes' );
add_filter( 'cmb_meta_boxes', 'page_metaboxes' );
add_filter( 'cmb_meta_boxes', 'work_metaboxes' );
add_filter( 'cmb_meta_boxes', 'team_metaboxes' );
add_filter( 'cmb_meta_boxes', 'slider_metaboxes' );

function global_metaboxes( array $meta_boxes ) {

// Start with an underscore to hide fields from custom fields list
$prefix = '_general_';

$meta_boxes[] = array(
'id' => 'general_metabox',
'title' => 'General Options',
'pages' => array( 'page' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Header Element',
'desc' => '',
'id' => $prefix .'header',
'type' => 'select',
'std' => 'none',
'options' => array(
array( 'value' => '', 'name' => 'Page Title' ),
array( 'value' => 'flexslider', 'name' => 'Flex Slider' ),
array( 'value' => 'cameraslider', 'name' => 'Camera Slider' ),
array( 'value' => 'precontent', 'name' => 'Pre Content' ),
),
),
array(
'name' => 'Sub Title',
'desc' => '',
'id' => $prefix .'subtitle',
'type' => 'text_large',
),
array(
'name' => 'Select Post Slider',
'desc' => '',
'id' => $prefix .'slider',
'type' => 'slider_select',
),
array(
'name' => 'Pre Content',
'desc' => '',
'id' => $prefix .'precontent',
'type' => 'wysiwyg',
),
),
);

$meta_boxes[] = array(
'id' => 'general_metabox',
'title' => 'General Options',
'pages' => array( 'post', 'work' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Sub Title',
'desc' => '',
'id' => $prefix .'subtitle',
'type' => 'text_large',
),
),
);

return $meta_boxes;
}

function blog_metaboxes( array $meta_boxes ) {

// Start with an underscore to hide fields from custom fields list
$prefix = '_blog_';

$meta_boxes[] = array(
'id' => 'blog_quote_metabox',
'title' => 'Quote',
'pages' => array( 'post' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Quote',
'desc' => '',
'id' => $prefix .'quote',
'type' => 'textarea_small',
),
array(
'name' => 'Quote Author',
'desc' => '',
'id' => $prefix .'quote_author',
'type' => 'text_medium',
),
),
);

$meta_boxes[] = array(
'id' => 'blog_video_metabox',
'title' => 'Video',
'pages' => array( 'post' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Video URL (Recommended)',
'desc' => 'Youtube or Vimeo',
'id' => $prefix .'video',
'type' => 'text_large',
),
array(
'name' => 'Video Embed Code',
'desc' => '',
'id' => $prefix .'video_embed',
'type' => 'textarea_code',
),
),
);

return $meta_boxes;
}

function page_metaboxes( array $meta_boxes ) {

// Start with an underscore to hide fields from custom fields list
$prefix = '_page_';

$meta_boxes[] = array(
'id' => 'page_metabox',
'title' => 'Page Templates',
'pages' => array( 'page' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Page Template',
'desc' => '',
'id' => $prefix .'template',
'type' => 'select',
'options' => array(
array( 'value' => 'default', 'name' => 'Page Default' ),
array( 'value' => 'blog', 'name' => 'Blog' ),
array( 'value' => 'work', 'name' => 'Work' ),
array( 'value' => 'team', 'name' => 'Team' ),
array( 'value' => 'sitemap', 'name' => 'Sitemap' ),
),
),
array(
'name' => 'Page Layout',
'desc' => '',
'id' => $prefix .'default',
'type' => 'select',
'std' => 'fw',
'options' => array(
array( 'value' => 'fw', 'name' => 'Full Width' ),
array( 'value' => 'lb', 'name' => 'Left Sidebar' ),
array( 'value' => 'rb', 'name' => 'Right Sidebar' ),
),
),
array(
'name' => 'Work Layout',
'desc' => '',
'id' => $prefix .'work',
'type' => 'select',
'std' => 'fw_4',
'options' => array(
array( 'value' => 'fw_2', 'name' => '2 Columns' ),
array( 'value' => 'fw_3', 'name' => '3 Columns' ),
array( 'value' => 'fw_4', 'name' => '4 Columns' ),
),
),
array(
'name' => 'Team Layout',
'desc' => '',
'id' => $prefix .'team',
'type' => 'select',
'std' => 'fw_4',
'options' => array(
array( 'value' => 'fw_2', 'name' => '2 Columns' ),
array( 'value' => 'fw_3', 'name' => '3 Columns' ),
array( 'value' => 'fw_4', 'name' => '4 Columns' ),
),
),
array(
'name' => 'Page Sidebar',
'desc' => '',
'id' => $prefix .'sidebar',
'type' => 'select_sidebar',
'std' => ''
),
),
);

$meta_boxes[] = array(
'id' => 'page_blog_metabox',
'title' => 'Blog Layout Options',
'pages' => array( 'page' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Category',
'desc' => '',
'id' => $prefix .'blog_cat',
'type' => 'taxonomy_select',
'taxonomy'=> 'category',
),
array(
'name' => 'Display per Page',
'desc' => '',
'id' => $prefix .'blog_num',
'type' => 'text_small',
'std' => '10',
),
),
);

$meta_boxes[] = array(
'id' => 'page_work_metabox',
'title' => 'Work Layout Options',
'pages' => array( 'page' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Category',
'desc' => '',
'id' => $prefix .'work_cat',
'type' => 'taxonomy_select',
'taxonomy'=> 'work-category',
),
array(
'name' => 'Display per Page',
'desc' => '',
'id' => $prefix .'work_num',
'type' => 'text_small',
'std' => '10',
),
array(
'name' => 'Show Filter',
'desc' => '',
'id' => $prefix .'work_filter',
'type' => 'select',
'std' => '1',
'options' => array(
array( 'value' => '0', 'name' => 'No' ),
array( 'value' => '1', 'name' => 'Yes' ),
),
),
),
);

$meta_boxes[] = array(
'id' => 'page_team_metabox',
'title' => 'Team Layout Options',
'pages' => array( 'page' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Category',
'desc' => '',
'id' => $prefix .'team_cat',
'type' => 'taxonomy_select',
'taxonomy'=> 'team-category',
),
array(
'name' => 'Display per Page',
'desc' => '',
'id' => $prefix .'team_num',
'type' => 'text_small',
'std' => '10',
),
array(
'name' => 'Show Filter',
'desc' => '',
'id' => $prefix .'team_filter',
'type' => 'select',
'std' => '1',
'options' => array(
array( 'value' => '0', 'name' => 'No' ),
array( 'value' => '1', 'name' => 'Yes' ),
),
),
),
);

return $meta_boxes;
}

function work_metaboxes( array $meta_boxes ) {

// Start with an underscore to hide fields from custom fields list
$prefix = '_work_';

$meta_boxes[] = array(
'id' => 'work_metabox',
'title' => 'Work Options',
'pages' => array( 'work' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Date Launched',
'desc' => 'Date launched of work.',
'id' => $prefix .'date',
'type' => 'text_date_timestamp',
),
array(
'name' => 'Client Name',
'desc' => 'Client name of work.',
'id' => $prefix .'client',
'type' => 'text_medium',
),
array(
'name' => 'Website URL',
'desc' => 'A website to actual work url.',
'id' => $prefix .'website',
'type' => 'text_medium',
),
array(
'name' => 'Enable Lightbox',
'desc' => '',
'id' => $prefix .'lightbox',
'type' => 'select',
'options' => array(
array( 'value' => '0', 'name' => 'No' ),
array( 'value' => '1', 'name' => 'Yes' ),
),
),
array(
'name' => 'Work Type',
'desc' => '',
'id' => $prefix .'type',
'type' => 'select',
'options' => array(
array( 'value' => 'image', 'name' => 'Image' ),
array( 'value' => 'video', 'name' => 'Video' ),
array( 'value' => 'slider', 'name' => 'Slider' ),
),
),
array(
'name' => 'Image URL',
'desc' => 'Upload an image or enter an URL.',
'id' => $prefix .'image',
'type' => 'image',
),
array(
'name' => 'Thumbnail URL',
'desc' => 'Upload an image or enter an URL.',
'id' => $prefix .'video_thumb',
'type' => 'image',
),
array(
'name' => 'Video URL',
'desc' => 'This theme only supports video from Youtube and Vimeo.',
'id' => $prefix .'video',
'type' => 'text_large',
),
array(
'name' => 'Slider',
'desc' => 'Upload an image or select from media.',
'id' => $prefix .'slider',
'type' => 'image_slider',
),
),
);

return $meta_boxes;
}

function team_metaboxes( array $meta_boxes ) {

// Start with an underscore to hide fields from custom fields list
$prefix = '_team_';

$meta_boxes[] = array(
'id' => 'team_metabox',
'title' => 'Team Options',
'pages' => array( 'team' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(


array(
'name' => 'Website URL',
'desc' => 'Does this Mentor have a website?.',
'id' => $prefix .'website',
'type' => 'text_medium',
),
array(
'name' => 'Affiliation',
'desc' => 'Affiliation??.',
'id' => $prefix .'affiliation',
'type' => 'text_medium',
),
array(
'name' => 'Twitter',
'desc' => 'Twitter Handle',
'id' => $prefix .'twitter',
'type' => 'text_medium',
),
array(
'name' => 'Linkedin',
'desc' => 'Linkedin URL',
'id' => $prefix .'linkedin',
'type' => 'text_medium',
),


array(
'name' => 'Image URL',
'desc' => 'Upload an image or enter an URL.',
'id' => $prefix .'image',
'type' => 'image',
),
array(
'name' => 'Thumbnail URL',
'desc' => 'Upload an image or enter an URL.',
'id' => $prefix .'video_thumb',
'type' => 'image',
),
array(
'name' => 'Video URL',
'desc' => 'This theme only supports video from Youtube and Vimeo.',
'id' => $prefix .'video',
'type' => 'text_large',
),
array(
'name' => 'Slider',
'desc' => 'Upload an image or select from media.',
'id' => $prefix .'slider',
'type' => 'image_slider',
),
),
);

return $meta_boxes;
}


function slider_metaboxes( array $meta_boxes ) {

// Start with an underscore to hide fields from custom fields list
$prefix = '_slider_';

$meta_boxes[] = array(
'id' => 'slider_metabox',
'title' => 'Slide Lists',
'pages' => array( 'slider' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Slider',
'desc' => '',
'id' => $prefix .'slider',
'type' => 'slider',
),
),
);

return $meta_boxes;
}

add_action( 'init', 'cmb_initialize_cmb_meta_boxes', 9999 );

function cmb_initialize_cmb_meta_boxes() {

if ( ! class_exists( 'cmb_Meta_Box' ) )
require_once AZURE_ADMIN .'/metaboxes/init.php';

}


I'm unsure which other files I will need to ammend with this theme I guess?


Arnav Joy comments:

why are you creating different taxonomy for it , i think you can use built in work taxonomy for this work , and can add team custom post type to work with the default work taxonomy

and for this you do not have to register any taxonomy , just register team post type as you are doing and change following code

register_taxonomy('work-category',

array('work'),

array(

'hierarchical' => true,

'label' => 'Work Categories',

'singular_label' => 'Work Categories',

'rewrite' => true,

'query_var' => true

));



to

register_taxonomy('work-category',

array('work','team'),

array(

'hierarchical' => true,

'label' => 'Work Categories',

'singular_label' => 'Work Categories',

'rewrite' => true,

'query_var' => true

));


Daniel Q comments:

Hi,

@Arnav_Joy I implemented this suggestion but the outcome is not what was needed.

I have attached a screenshot of the outcome of this method

As described I am trying to create a taxonomy for 'Team'. I need to be able to add team members in different categories. I need to relate individual team members to projects created under 'Works'. The relationship here will work both ways, using the UX of the 'Captivate' Theme I want to create a page called 'Team' which will show all team members using the same interface options as 'Works' and further, allow users to organise team members by category (a team member may belong in more than one category).

When I add items to 'Works' I want to be able to assign 'Team' members to this project.

When a user views a team member, I want them to see a list of projects this team member has been involved in. Team taxonomy will have different cpt to the works taxonomy. I am trying to figure out how I can do this?