Example #1
0
function hocwp_register_post_type_private($args = array())
{
    global $hocwp_private_post_types;
    $args['public'] = false;
    $args['exclude_from_search'] = true;
    $args['show_in_nav_menus'] = false;
    $args['show_in_admin_bar'] = false;
    $args['menu_position'] = 9999999;
    $args['has_archive'] = false;
    $args['query_var'] = false;
    $args['rewrite'] = false;
    $args['feeds'] = false;
    $slug = isset($args['slug']) ? $args['slug'] : '';
    if (!empty($slug)) {
        $hocwp_private_post_types = hocwp_sanitize_array($hocwp_private_post_types);
        $hocwp_private_post_types[] = $slug;
    }
    hocwp_register_post_type($args);
}
Example #2
0
function hocwp_register_post_type_news($args = array())
{
    $lang = hocwp_get_language();
    $slug = 'news';
    if ('vi' == $lang) {
        $slug = 'tin-tuc';
    }
    $slug = apply_filters('hocwp_post_type_news_base_slug', $slug);
    $slug = apply_filters('hocwp_post_type_news_slug', $slug);
    $defaults = array('name' => __('News', 'hocwp-theme'), 'slug' => $slug, 'post_type' => 'news', 'show_in_admin_bar' => true, 'supports' => array('editor', 'thumbnail', 'comments'));
    $args = wp_parse_args($args, $defaults);
    hocwp_register_post_type($args);
    $slug = 'news-cat';
    if ('vi' == $lang) {
        $slug = 'chuyen-muc';
    }
    $slug = apply_filters('hocwp_taxonomy_news_category_base_slug', $slug);
    $args = array('name' => __('News Categories', 'hocwp-theme'), 'singular_name' => __('News Category', 'hocwp-theme'), 'post_types' => 'news', 'menu_name' => __('Categories', 'hocwp-theme'), 'slug' => $slug, 'taxonomy' => 'news_cat');
    hocwp_register_taxonomy($args);
    $news_tag = apply_filters('hocwp_post_type_news_tag', false);
    if ($news_tag) {
        $slug = 'news-tag';
        if ('vi' == $lang) {
            $slug = 'the';
        }
        $slug = apply_filters('hocwp_taxonomy_news_tag_base_slug', $slug);
        $args = array('name' => __('News Tags', 'hocwp-theme'), 'singular_name' => __('News Tag', 'hocwp-theme'), 'post_types' => 'news', 'menu_name' => __('Tags', 'hocwp-theme'), 'slug' => $slug, 'hierarchical' => false, 'taxonomy' => 'news_tag');
        hocwp_register_taxonomy($args);
    }
}