رفتن به مطلب

proma

عضو سایت
  • تعداد ارسال‌ها

    2
  • تاریخ عضویت

  • آخرین بازدید

نوشته‌ها ارسال شده توسط proma

  1. سلام خسته نباشید

     

    بنده 3 مورد دسته بندی متفاوت برای سه نوع post_type متفاوت دارم

     

    <?php
    function codex_slider_init() {
        $labels = array(
            'name' => _x('اسلایدر ها', 'post type general name'),
            'singular_name' => _x('اسلایدر', 'post type singular name'),
            'add_new' => _x('افزودن اسلایدر', 'project'),
            'add_new_item' => __('افزودن اسلایدر'),
            'edit_item' => __('ویرایش اسلایدر'),
            'new_item' => __('اسلایدر جدید'),
            'all_items' => __('همه اسلایدر ها'),
            'view_item' => __('نمایش اسلایدر'),
            'search_items' => __('جستجو اسلایدر ها'),
            'not_found' =>  __('اسلایدر ای یافت نشد'),
            'not_found_in_trash' => __('اسلایدر ای در سطل زباله یافت نشد'),
            'parent_item_colon' => '',
            'menu_name' => __('اسلایدر ها')
    
        );
        $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'query_var' => true,
            'rewrite' => true,
            'capability_type' => 'post',
            'has_archive' => true,
            'hierarchical' => false,
            'menu_position' => null,
            'supports' => array( 'title', 'editor', 'thumbnail'),
        );
        register_post_type('sliders',$args);
    }
    add_action( 'init', 'codex_slider_init' );
    
    
    
    function codex_hosting_plans_init() {
        $labels = array(
            'name' => _x('هاست ها', 'post type general name'),
            'singular_name' => _x('هاست', 'post type singular name'),
            'add_new' => _x('افزودن هاست', 'project'),
            'add_new_item' => __('افزودن هاست'),
            'edit_item' => __('ویرایش هاست'),
            'new_item' => __('هاست جدید'),
            'all_items' => __('همه هاست ها'),
            'view_item' => __('نمایش هاست'),
            'search_items' => __('جستجو هاست ها'),
            'not_found' =>  __('هاست ای یافت نشد'),
            'not_found_in_trash' => __('هاست ای در سطل زباله یافت نشد'),
            'parent_item_colon' => '',
            'menu_name' => __('هاست ها')
    
        );
        $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'query_var' => true,
            'rewrite' => true,
            'capability_type' => 'post',
            'has_archive' => true,
            'hierarchical' => false,
            'menu_position' => null,
            'supports' => array( 'title', 'editor', 'thumbnail' ),
        );
        register_post_type('hosting',$args);
    }
    add_action( 'init', 'codex_hosting_plans_init' );
    
    
    function tr_create_hosting_taxonomy() {
    
        register_taxonomy(
            'hosting-category',
            'hosting',
            array(
                'label' => __( 'دسته بندی هاستینگ' ),
                'rewrite' => array( 'slug' => 'hosting-category' ),
                'hierarchical' => true,
            )
        );
    }
    add_action( 'init', 'tr_create_hosting_taxonomy' );
    
    
    
    function codex_services_init() {
        $labels = array(
            'name' => _x('خدمات', 'post type general name'),
            'singular_name' => _x('خدمات', 'post type singular name'),
            'add_new' => _x('افزودن خدمات', 'project'),
            'add_new_item' => __('افزودن خدمات'),
            'edit_item' => __('ویرایش خدمات'),
            'new_item' => __('خدمات جدید'),
            'all_items' => __('همه خدمات'),
            'view_item' => __('نمایش خدمات'),
            'search_items' => __('جستجو خدمات'),
            'not_found' =>  __('خدمات یافت نشد'),
            'not_found_in_trash' => __('خدمات در سطل زباله یافت نشد'),
            'parent_item_colon' => '',
            'menu_name' => __('خدمات')
    
        );
        $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'query_var' => true,
            'rewrite' => true,
            'capability_type' => 'post',
            'has_archive' => true,
            'hierarchical' => false,
            'menu_position' => null,
            'supports' => array( 'title', 'editor', 'thumbnail'),
        );
        register_post_type('services',$args);
    }
    add_action( 'init', 'codex_services_init' );
    
    
    
    
    
    function codex_portofino_init() {
        $labels = array(
            'name' => _x('نمونه کار ها', 'post type general name'),
            'singular_name' => _x('نمونه کار', 'post type singular name'),
            'add_new' => _x('افزودن نمونه کار', 'project'),
            'add_new_item' => __('افزودن نمونه کار'),
            'edit_item' => __('ویرایش نمونه کار'),
            'new_item' => __('خدمات نمونه کار'),
            'all_items' => __('همه نمونه کار ها'),
            'view_item' => __('نمایش نمونه کار'),
            'search_items' => __('جستجو نمونه کار'),
            'not_found' =>  __('نمونه کار یافت نشد'),
            'not_found_in_trash' => __('نمونه کار در سطل زباله یافت نشد'),
            'parent_item_colon' => '',
            'menu_name' => __('نمونه کار')
    
        );
        $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'query_var' => true,
            'rewrite' => true,
            'capability_type' => 'post',
            'has_archive' => true,
            'hierarchical' => false,
            'menu_position' => null,
            'supports' => array( 'title', 'editor', 'thumbnail'),
        );
        register_post_type('portofino',$args);
    }
    add_action( 'init', 'codex_portofino_init' );
    
    
    
    
    function tr_create_portofino_taxonomy() {
    
        register_taxonomy(
            'portofino-category',
            'portofino',
            array(
                'label' => __( 'دسته بندی نمونه کار ها' ),
                'rewrite' => array( 'slug' => 'portofino-category' ),
                'hierarchical' => true,
            )
        );
    }
    add_action( 'init', 'tr_create_portofino_taxonomy' );
    
    
    
    
    
    
    
    
    
    function codex_brands_init() {
        $labels = array(
            'name' => _x('برند ها', 'post type general name'),
            'singular_name' => _x('برند', 'post type singular name'),
            'add_new' => _x('افزودن برند', 'project'),
            'add_new_item' => __('افزودن برند'),
            'edit_item' => __('ویرایش برند'),
            'new_item' => __('خدمات برند'),
            'all_items' => __('همه برند ها'),
            'view_item' => __('نمایش برند'),
            'search_items' => __('جستجو برند'),
            'not_found' =>  __('برند یافت نشد'),
            'not_found_in_trash' => __('برند در سطل زباله یافت نشد'),
            'parent_item_colon' => '',
            'menu_name' => __('برند')
    
        );
        $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'query_var' => true,
            'rewrite' => true,
            'capability_type' => 'post',
            'has_archive' => true,
            'hierarchical' => false,
            'menu_position' => null,
            'supports' => array( 'title', 'editor', 'thumbnail' ),
        );
        register_post_type('brands',$args);
    }
    add_action( 'init', 'codex_brands_init' );
    
    
    
    
    
    
    function codex_video_init() {
        $labels = array(
            'name' => _x('ویدیو های آموزشی', 'post type general name'),
            'singular_name' => _x('ویدیو های آموزشینمونه کار', 'post type singular name'),
            'add_new' => _x('افزودن ویدیو آموزشی', 'project'),
            'add_new_item' => __('افزودن ویدیو آموزشی'),
            'edit_item' => __('ویرایش ویدیو آموزشی'),
            'new_item' => __('خدمات ویدیو آموزشی'),
            'all_items' => __('همه ویدیو های آموزشی'),
            'view_item' => __('نمایش ویدیو های آموزشی'),
            'search_items' => __('جستجو ویدیو آموزشی'),
            'not_found' =>  __('ویدیو آموزشی یافت نشد'),
            'not_found_in_trash' => __('ویدیو آموزشی در سطل زباله یافت نشد'),
            'parent_item_colon' => '',
            'menu_name' => __('ویدیو آموزشی')
    
        );
        $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'query_var' => true,
            'rewrite' => true,
            'capability_type' => 'post',
            'has_archive' => true,
            'hierarchical' => false,
            'menu_position' => null,
            'supports' => array( 'title', 'editor', 'thumbnail' ),
        );
        register_post_type('tutorial_videos',$args);
    }
    add_action( 'init', 'codex_video_init' );
    
    
    
    function tr_create_services_taxonomy() {
    
        register_taxonomy(
            'services-category',
            'services',
            array(
                'label' => __( 'دسته بندی خدمات' ),
                'rewrite' => array( 'slug' => 'services-category' ),
                'hierarchical' => true,
            )
        );
    }
    add_action( 'init', 'tr_create_services_taxonomy' );
    
    
    
    function tr_create_video_taxonomy() {
    
        register_taxonomy(
            'tutorial-category',
            'tutorial_videos',
            array(
                'label' => __( 'دسته بندی ویدیو های آموزشی' ),
                'rewrite' => array( 'slug' => 'tutorial-category' ),
                'hierarchical' => true,
            )
        );
    }
    add_action( 'init', 'tr_create_video_taxonomy' );
    
    
    
    
    

    کدش رو میتونید ببینید

    services-category/خلاصه-خدمات/

    لینک بالا کار میکنه ولی دو تا لینک

    /tutorial-category/طراحی-وب/

    /portofino-category/تست/

    ارور 404 میدن و فایل  404.php رو اجرا میکنن

     

    سه تا فایلو برای هر سه مورد دسته بندی ساختم

    taxonomy-portofino-category.php

    taxonomy-services-category.php

    taxonomy-tutorial-category.php

     

    ولی فقط فایل taxonomy-services-category.php درست کار میکنه و دسته بندی tutorial , portofino باز نمیشن و بجاشون 404 باز میشه !

     

    ممنون میشم راهنمایی کنید

     

    عکس منو های سایت هم اتچ کردم

    Untitled.png

×
×
  • اضافه کردن...