File: /var/www/vhosts/miroglu.net/subdomains/serhatburke/wp-content/plugins/kk-cpt/kk-cpt-func.php
<?php
/**
* Plugin Name: Kotofey Custom Post Types
* Plugin URI: http://themeforest.net/user/kotofey
* Description: Adds a custom post types needed for correct functionality in Kotofey's themes.
* Version: 1.3
* Author: Kotofey
* Author URI: http://themeforest.net/user/kotofey
* License: Regular License
* License URI: http://themeforest.net/licenses
*/
add_theme_support( 'kk-cpt' );
/*-----------------------------------------------------------------------------------*/
/* ADD PORTFOLIO POST TYPE
/*-----------------------------------------------------------------------------------*/
function kk_create_portfolio_post_type()
{
$labels = array(
'name' => esc_html__('Portfolio','toppic' ),
'all_items' => esc_html__('All Projects','toppic' ),
'singular_name' => esc_html__('Portfolio','toppic' ),
'add_new' => esc_html__('Add Project','toppic'),
'add_new_item' => esc_html__('Add New project','toppic' ),
'edit_item' => esc_html__('Edit Project','toppic' ),
'new_item' => esc_html__('New Project','toppic' ),
'view_item' => esc_html__('View Project','toppic' ),
'search_items' => esc_html__('Search Project','toppic' ),
'not_found' => esc_html__('No project found','toppic' ),
'not_found_in_trash' => esc_html__('No project found in Trash','toppic' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'menu_position' => 5,
'rewrite' => array( 'slug' => apply_filters( 'kktfwp_portfolio_slug', 'portfolio' ), 'with_front' => false ),
'supports' => array('title','editor','excerpt','thumbnail','custom-fields','comments'),
'query_var' => true,
'show_in_nav_menus' => true,
'capability_type' => 'post',
);
register_post_type('portfolio',$args);
}
add_action( 'init', 'kk_create_portfolio_post_type' );
// Register taxonomy
function kk_register_portfolio_taxonomy()
{
$tax_labels = array(
'name' => 'Portfolio Category',
'singular_name' => 'Portfolio Category',
'search_items' => 'Search Portfolio Categories',
'popular_items' => 'Popular Portfolio Categories',
'all_items' => 'All Portfolio Categories',
'parent_item' => 'Parent Portfolio Category',
'parent_item_colon' => 'Parent Portfolio Category',
'edit_item' => 'Edit Portfolio Category',
'update_item' => 'Update Portfolio Category',
'add_new_item' => 'Add New Portfolio Category',
'new_item_name' => 'New Portfolio Category Name',
'separate_items_with_commas' => 'Separate portfolio ctegories with commas',
'add_or_remove_items' => 'Add or remove portfolio categories',
'choose_from_most_used' => 'Choose from the most used portfolio categories',
'menu_name' => 'Portfolio Categories'
);
register_taxonomy('portfolio-type',
array('portfolio'),
array(
'hierarchical'=>true,
'show_ui'=>true,
'labels' => $tax_labels,
'public' => true,
'query_var'=> true,
'label' => 'Portfolio Categories',
'rewrite' => array('slug' => apply_filters( 'kktfwp_portfolio_cat_slug', 'portfolio-type' ), 'with_front' => false )
)
);
}
add_action( 'init', 'kk_register_portfolio_taxonomy' );
/*-----------------------------------------------------------------------------------*/
/* ADD GALLERY POST TYPE
/*-----------------------------------------------------------------------------------*/
function kk_create_gallery_post_type()
{
$labels = array(
'name' => esc_html__('Galleries','toppic' ),
'all_items' => esc_html__('All Galleries','toppic' ),
'singular_name' => esc_html__('Gallery','toppic' ),
'add_new' => esc_html__('Add Gallery','toppic'),
'add_new_item' => esc_html__('Add New Gallery','toppic' ),
'edit_item' => esc_html__('Edit Gallery','toppic' ),
'new_item' => esc_html__('New Gallery','toppic' ),
'view_item' => esc_html__('View Gallery','toppic' ),
'search_items' => esc_html__('Search Gallery','toppic' ),
'not_found' => esc_html__('No gallery found','toppic' ),
'not_found_in_trash' => esc_html__('No gallery found in Trash','toppic' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'menu_position' => 6,
// Uncomment the following line to change the slug;
'rewrite' => array( 'slug' => apply_filters( 'kktfwp_gallery_slug', 'gallery' ), 'with_front' => false ),
'supports' => array('title','editor','thumbnail','comments'),
'query_var' => true,
'show_in_nav_menus' => true,
'capability_type' => 'post'
);
register_post_type('gallery',$args);
}
add_action( 'init', 'kk_create_gallery_post_type' );
// Register taxonomy
function kk_register_gallery_taxonomy()
{
$tax_labels = array(
'name' => 'Gallery Category',
'singular_name' => 'Gallery Type',
'search_items' => 'Search Gallery Types',
'popular_items' => 'Popular Gallery Categories',
'all_items' => 'All Gallery Categories',
'parent_item' => 'Parent Gallery Type',
'parent_item_colon' => 'Parent Gallery Type:',
'edit_item' => 'Edit Gallery Category',
'update_item' => 'Update Gallery Category',
'add_new_item' => 'Add New Gallery Category',
'new_item_name' => 'New Gallery Category Name',
'separate_items_with_commas' => 'Separate gallery types with commas',
'add_or_remove_items' => 'Add or remove gallery types',
'choose_from_most_used' => 'Choose from the most used gallery types',
'menu_name' => 'Gallery Categories'
);
register_taxonomy('gallery-type',
array('gallery'),
array(
'hierarchical'=>true,
'show_ui'=>true,
'labels' => $tax_labels,
'public' => true,
'query_var'=> true,
'label' => 'Galleries',
'rewrite' => array('slug' => apply_filters( 'kktfwp_gallery_cat_slug', 'gallery-type' ), 'with_front' => false )
)
);
}
add_action( 'init', 'kk_register_gallery_taxonomy' );
/*-----------------------------------------------------------------------------------*/
/* ADD SLIDER POST TYPE
/*-----------------------------------------------------------------------------------*/
function kk_create_slider_post_type()
{
$labels = array(
'name' => esc_html__('Slides','toppic' ),
'all_items' => esc_html__('All Slides','toppic' ),
'singular_name' => esc_html__('Slide','toppic' ),
'add_new' => esc_html__('Add Slide','toppic'),
'add_new_item' => esc_html__('Add New Slide','toppic' ),
'edit_item' => esc_html__('Edit Slide','toppic' ),
'new_item' => esc_html__('New Slide','toppic' ),
'view_item' => esc_html__('View Slide','toppic' ),
'search_items' => esc_html__('Search Slide','toppic' ),
'not_found' => esc_html__('No slide found','toppic' ),
'not_found_in_trash' => esc_html__('No slide found in Trash','toppic' ),
);
$args = array(
'labels'=>$labels,
'public'=>true,
'menu_position'=>5,
// Uncomment the following line to change the slug;
// 'rewrite' => array( 'slug' => 'your-slug'),
'supports'=>array('title','thumbnail','custom-fields'),
'query_var' => true,
'show_in_nav_menus' => true,
'capability_type' => 'post'
);
register_post_type('slider',$args);
}
add_action( 'init', 'kk_create_slider_post_type' );
/*-----------------------------------------------------------------------------------*/
/* INITIALIZE VISUAL COMPOSER CUSTOM SHORTCODES
/*-----------------------------------------------------------------------------------*/
add_action( 'vc_before_init', 'kk_cpt_vcSetAsTheme' );
function kk_cpt_vcSetAsTheme() {
require_once dirname(__FILE__)."/inc/shortcodes.php";
}
require_once dirname(__FILE__)."/inc/kktfwp-custom-premalinks.php";
require_once dirname(__FILE__)."/inc/kktfwp-widget-flickr.php";
require_once dirname(__FILE__)."/inc/kktfwp-widget-portfolio.php";