关于海关邮政型分类名称两部分的几个问题

时间:2017-01-24 作者:user1760110

我面临创建自定义帖子类型和分类的问题。

我应该如何命名自定义分类法模板?是taxonomy-special_offer_type.php 正确的名称?

这是WP查询的正确方式吗?

$args = array( \'post_type\' => \'special_offer\', \'posts_per_page\' => 500 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
the_title();
the_content();
endwhile;
\'rewrite\' => array(\'slug\' => \'Special Offers\') 这是一个正确的slug名称吗?

自定义帖子类型应使用什么名称?我在两个函数中使用相同的名称:

function cpt_special_offer() {
        $labels = array(
        \'name\' => \'Special Offers\',
        \'singular_name\' => \'Special Offer\',
        \'menu_name\' => \'Special Offers\',
        \'name_admin_bar\' => \'Special Offers\',
        \'parent_item_colon\' => \'Parent Special Offers:\',
        \'all_items\' => \'All Special Offers\',
        \'view_item\' => \'View Special Offers\',
        \'add_new_item\' => \'Add New Special Offer\',
        \'add_new\' => \'Add New Special Offer\',
        \'new_item\' => \'New Special Offer\',
        \'edit_item\' => \'Edit Special Offer\',
        \'update_item\' => \'Update Special Offer\',
        \'search_items\' => \'Search Special Offer\',
        \'not_found\' => \'Special Offer Not found\',
        \'not_found_in_trash\' => \'Special Offer Not found in Trash\',
    );
    $args = array(
        \'label\' => \'Special Offers\',
        \'description\' => \'This Post Type Adds Special Offers to Website\',
        \'labels\' => $labels,
        \'supports\' => array( \'title\', \'thumbnail\', ),
        \'taxonomies\' => array( \'special_offer\' ),
        \'hierarchical\' => true,
        \'public\' => true,
        \'show_ui\' => true,
        \'show_in_menu\' => true,
        \'show_in_nav_menus\' => true,
        \'show_in_admin_bar\' => true,
        \'menu_position\' => 5,
        \'can_export\' => true,
        \'has_archive\' => true,
        \'rewrite\' => array(\'slug\' => \'Special Offers\'),
        \'exclude_from_search\' => false,
        \'publicly_queryable\' => true,
        \'capability_type\' => \'post\',
    );
    register_post_type( \'special_offer\', $args );
} 
add_action( \'init\', \'cpt_special_offer\', 0 );

function tax_special_offer() {
    $labels = array(
        \'name\' => \'Special Offer Types\',
        \'singular_name\' => \'Special Offer Type\',
        \'menu_name\' => \'Special Offer Types\',
        \'all_items\' => \'All Special Offer Types\',
        \'parent_item\' => \'Parent Special Offer Types\',
        \'parent_item_colon\' => \'Parent Special Offer Types:\',
        \'new_item_name\' => \'New Special Offer Type\',
        \'add_new_item\' => \'Add New Special Offer Type\',
        \'edit_item\' => \'Edit Special Offer Type\',
        \'update_item\' => \'Update Special Offer Type\',
        \'separate_items_with_commas\' => \'Separate Special Offer Type with commas\',
        \'search_items\' => \'Search Special Offer Type\',
        \'add_or_remove_items\' => \'Add or Remove Special Offer Type\',
        \'choose_from_most_used\' => \'Choose from the most used Special Offer Types\',
        \'not_found\' => \'Special Offer Types Not Found\',
    );
    $args = array(
        \'labels\' => $labels,
        \'hierarchical\' => true,
        \'public\' => true,
        \'show_ui\' => true,
        \'show_admin_column\' => true,
        \'show_in_nav_menus\' => true,
        \'show_tagcloud\' => true,
    );
    register_taxonomy( \'special_offer_type\', array( \'special_offer\' ), $args );
    }
add_action( \'init\', \'tax_special_offer\', 0 );

1 个回复
SO网友:AceWebDesign

slug指的是urleghttp://wwww.sitename.com//

所以你想让它没有空间,而且价格更低特价

相关推荐