File: /mnt/data/smarthr-co-in/wp-content/themes/dreamslanding/inc/register_widget.php
<?php
/* Register Menu */
add_action( 'init', 'dreamstour_register_menus' );
function dreamstour_register_menus() {
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu','dreamstour' )
) );
}
/* Register Widget */
add_action( 'widgets_init', 'dreamstour_second_widgets_init' );
function dreamstour_second_widgets_init() {
$args_blog = array(
'name' => esc_html__( 'Blog Sidebar' ,'dreamstour'),
'id' => "blog-sidebar",
'description' => esc_html__( 'Main Sidebar','dreamstour' ),
'class' => '',
'before_widget' => '<div id="%1$s" class="widget card %2$s">',
'after_widget' => "</div>",
'before_title' => '<div class="card-header border-0 pb-3">
<div class="pb-3 border-bottom">
<h5> ',
'after_title' => "</h5></div></div>",
);
register_sidebar( $args_blog );
}
add_action( 'init', 'dreamstour_register_case_study_cpt' );
function dreamstour_register_case_study_cpt() {
$labels = array(
'name' => __( 'Case Studies', 'dreamstour' ),
'singular_name' => __( 'Case Study', 'dreamstour' ),
'add_new' => __( 'Add New', 'dreamstour' ),
'add_new_item' => __( 'Add New Case Study', 'dreamstour' ),
'edit_item' => __( 'Edit Case Study', 'dreamstour' ),
'new_item' => __( 'New Case Study', 'dreamstour' ),
'view_item' => __( 'View Case Study', 'dreamstour' ),
'search_items' => __( 'Search Case Studies', 'dreamstour' ),
'not_found' => __( 'No case studies found', 'dreamstour' ),
'not_found_in_trash' => __( 'No case studies found in Trash', 'dreamstour' ),
'all_items' => __( 'All Case Studies', 'dreamstour' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_rest' => true,
'has_archive' => false,
'rewrite' => array( 'slug' => 'case-studies' ),
'menu_icon' => 'dashicons-portfolio',
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'author', 'comments' ),
'taxonomies' => array( 'case_study_category' ),
);
register_post_type( 'case_study', $args );
}
// Register standalone Case Study Category taxonomy
add_action( 'init', 'dreamstour_register_case_study_taxonomy' );
function dreamstour_register_case_study_taxonomy() {
$labels = array(
'name' => __( 'Case Study Categories', 'dreamstour' ),
'singular_name' => __( 'Case Study Category', 'dreamstour' ),
'search_items' => __( 'Search Categories', 'dreamstour' ),
'all_items' => __( 'All Categories', 'dreamstour' ),
'parent_item' => __( 'Parent Category', 'dreamstour' ),
'parent_item_colon' => __( 'Parent Category:', 'dreamstour' ),
'edit_item' => __( 'Edit Category', 'dreamstour' ),
'update_item' => __( 'Update Category', 'dreamstour' ),
'add_new_item' => __( 'Add New Category', 'dreamstour' ),
'new_item_name' => __( 'New Category Name', 'dreamstour' ),
'menu_name' => __( 'Case Study Categories', 'dreamstour' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'case-study-category' ),
'show_in_rest' => true,
);
register_taxonomy( 'case_study_category', array( 'case_study' ), $args );
}
// Register Article CPT
add_action( 'init', 'dreamstour_register_article_cpt' );
function dreamstour_register_article_cpt() {
$labels = array(
'name' => __( 'Articles', 'dreamstour' ),
'singular_name' => __( 'Article', 'dreamstour' ),
'add_new_item' => __( 'Add New Article', 'dreamstour' ),
'edit_item' => __( 'Edit Article', 'dreamstour' ),
'new_item' => __( 'New Article', 'dreamstour' ),
'view_item' => __( 'View Article', 'dreamstour' ),
'search_items' => __( 'Search Articles', 'dreamstour' ),
'not_found' => __( 'No articles found', 'dreamstour' ),
'not_found_in_trash' => __( 'No articles found in Trash', 'dreamstour' ),
'all_items' => __( 'All Articles', 'dreamstour' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_rest' => true,
'has_archive' => false,
'rewrite' => array( 'slug' => 'articles' ),
'menu_icon' => 'dashicons-media-text',
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'author', 'comments' ),
'taxonomies' => array( 'article_category' ),
);
register_post_type( 'article', $args );
}
// Register standalone Article Category taxonomy
add_action( 'init', 'dreamstour_register_article_taxonomy' );
function dreamstour_register_article_taxonomy() {
$labels = array(
'name' => __( 'Article Categories', 'dreamstour' ),
'singular_name' => __( 'Article Category', 'dreamstour' ),
'search_items' => __( 'Search Categories', 'dreamstour' ),
'all_items' => __( 'All Categories', 'dreamstour' ),
'parent_item' => __( 'Parent Category', 'dreamstour' ),
'parent_item_colon' => __( 'Parent Category:', 'dreamstour' ),
'edit_item' => __( 'Edit Category', 'dreamstour' ),
'update_item' => __( 'Update Category', 'dreamstour' ),
'add_new_item' => __( 'Add New Category', 'dreamstour' ),
'new_item_name' => __( 'New Category Name', 'dreamstour' ),
'menu_name' => __( 'Article Categories', 'dreamstour' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'article-category' ),
'show_in_rest' => true,
);
register_taxonomy( 'article_category', array( 'article' ), $args );
}