首页 \ 问答 \ 如何停止自定义帖子类型重定向到博客存档页面?(How can I stop custom post type redirecting to blog archive page?)

如何停止自定义帖子类型重定向到博客存档页面?(How can I stop custom post type redirecting to blog archive page?)

如何停止自定义帖子类型重定向到博客存档页面? 或者我们可以为自定义帖子类型显示创建单独的页面吗?

为Exhibits创建自定义帖子类型:

add_action('init','exhibits_custom_init');
function exhibits_custom_init(){

    $labels = array(
    'name' => _x('Exhibits', 'post type general name'),
    'singular_name' => _x('Exhibit', 'post type singular name'),
    'add_new' => _x('Add New', 'exhibit'),
    'add_new_item' => __('Add New Exhibit'),
    'edit_item' => __('Edit Exhibit'),
    'new_item' => __('New Exhibit'),
    'view_item' => __('View Exhibit'),
    'search_items' => __('Search Exhibits'),
    'not_found' => __('No Exhibits Found'),
    'not_found_in_trash' => __('No Exhibits Found in Trash'),
    'parent_item_colon' =>  '',
    'menu_name' => 'Exhibits'
    ); 

    $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'query_var' => true,
    'rewrite' => array('slug' => 'exhibit'),
    'capability_type' => 'post',
    'has_archive' => true,
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array('title','thumbnail','editor'),
    'taxonomies' => array('post_tag','post_category')   

    );
    register_post_type('exhibit',$args);
}

function my_taxonomies_exhibit(){
    $labels = array(
            'name'              => _x( 'Exhibit Categories', 'taxonomy general name' ),

        'singular_name'     => _x( 'Exhibit Category', 'taxonomy singular name' ),

        'search_items'      => __( 'Search Exhibit Categories' ),

        'all_items'         => __( 'All Exhibit Categories' ),

        'parent_item'       => __( 'Parent Exhibit Category' ),

        'parent_item_colon' => __( 'Parent Exhibit Category:' ),

        'edit_item'         => __( 'Edit Exhibit Category' ), 

        'update_item'       => __( 'Update Exhibit Category' ),

        'add_new_item'      => __( 'Add New Exhibit Category' ),

        'new_item_name'     => __( 'New Exhibit Category' ),

        'menu_name'         => __( 'Exhibit Categories' ),

    );

    $args = array(

        'labels' => $labels,
        'hierarchical' => true,
    );

    register_taxonomy( 'post_category', 'exhibit', $args );
}

add_action( 'init', 'my_taxonomies_exhibit', 0 );

此自定义帖子类型重定向到博客存档页面。 我想在内容页面或单独的页面中显示它。


How can I stop custom post type redirecting to blog archive page? Or can we create a separate page for custom post types display?

Creating custom post type for Exhibits:

add_action('init','exhibits_custom_init');
function exhibits_custom_init(){

    $labels = array(
    'name' => _x('Exhibits', 'post type general name'),
    'singular_name' => _x('Exhibit', 'post type singular name'),
    'add_new' => _x('Add New', 'exhibit'),
    'add_new_item' => __('Add New Exhibit'),
    'edit_item' => __('Edit Exhibit'),
    'new_item' => __('New Exhibit'),
    'view_item' => __('View Exhibit'),
    'search_items' => __('Search Exhibits'),
    'not_found' => __('No Exhibits Found'),
    'not_found_in_trash' => __('No Exhibits Found in Trash'),
    'parent_item_colon' =>  '',
    'menu_name' => 'Exhibits'
    ); 

    $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'query_var' => true,
    'rewrite' => array('slug' => 'exhibit'),
    'capability_type' => 'post',
    'has_archive' => true,
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array('title','thumbnail','editor'),
    'taxonomies' => array('post_tag','post_category')   

    );
    register_post_type('exhibit',$args);
}

function my_taxonomies_exhibit(){
    $labels = array(
            'name'              => _x( 'Exhibit Categories', 'taxonomy general name' ),

        'singular_name'     => _x( 'Exhibit Category', 'taxonomy singular name' ),

        'search_items'      => __( 'Search Exhibit Categories' ),

        'all_items'         => __( 'All Exhibit Categories' ),

        'parent_item'       => __( 'Parent Exhibit Category' ),

        'parent_item_colon' => __( 'Parent Exhibit Category:' ),

        'edit_item'         => __( 'Edit Exhibit Category' ), 

        'update_item'       => __( 'Update Exhibit Category' ),

        'add_new_item'      => __( 'Add New Exhibit Category' ),

        'new_item_name'     => __( 'New Exhibit Category' ),

        'menu_name'         => __( 'Exhibit Categories' ),

    );

    $args = array(

        'labels' => $labels,
        'hierarchical' => true,
    );

    register_taxonomy( 'post_category', 'exhibit', $args );
}

add_action( 'init', 'my_taxonomies_exhibit', 0 );

This custom post type redirecting to blog archive page. I want to display it in the content page or a separate page.


原文:https://stackoverflow.com/questions/17163236
更新时间:2021-09-07 09:09

最满意答案

查看有关会话处理( MSDN )的WCF文档如果您正在处理原型,则可以构建静态字典,在该字典中可以将值与会话密钥一起转储


Check out the WCF Documentation about Session handling (MSDN) If you´re working on a prototype you can get along building a static dictionary, in which you can dump your values in combination with a session key

相关问答

更多
  • 如果你想要持久连接,你应该使用pfsockopen而不是fsockopen 。 在这里查看更多详情。 If you want a persistent connection you should use pfsockopen instead of fsockopen. Look here for more details.
  • 假设通过variable你的意思是指一个可变的存储位置 ,我想主要区别(取决于你比较哪种语言)是,如果你动态地重新绑定Clojure中的var是基于每个线程的。 但长篇答案是,除非你真的需要参考一个可变的存储位置,否则你通常不会在Clojure中使用var 。 Clojure倾向于使用值而不是引用来进行不变性和编程。 你可以看Rich Hickey关于价值观的话题 。 总结一下,当你在Clojure中编程时,你所拥有的是值 ,而不是引用可能会改变的位置(甚至可能被另一个线程改变)。 所以。 (let [a ...
  • 如果前面的表达式的值是空字符串(如未定义的环境变量的情况下),那么可以使用带有选项的default过滤器来触发它: - APP_NAME: "{{ lookup('env', 'customName') | default(lookup('env', 'name'), true) | mandatory }}" You can use the default filter with an option to trigger it if the value of the preceding expressi ...
  • 以DateType字段为例。 在这里, value将像字符串2016-06-10 。 另一方面, data将是相应的DateTime -Object。 使用文本字段时,您将看不到任何差异,因为在这两种情况下都只会有一个字符串。 Take for example a DateType field. Here, value would be something like the string 2016-06-10. data on the other hand would be a corresponding ...
  • 您无法在Ansible中的单个参数内循环。 使用循环,因为Ansible旨在: - file: path: /home/vagrant/stunnelSimAnsPractice/roles/ns16/sessions/{{ item }} state: directory with_items: ### and here you need to put the list containing the directory names 遗憾的是,您没有提供变量的完整定义,因此您需 ...
  • 如果您不想要全局变量,则不要使用它们。 我不明白为什么找到一种不支持它们的语言会提供任何价值。 你正在处理范围问题。 让你的变量存在于尽可能最低的范围内,你会没事的。 没有没有全球范围的语言。 If you don't want global variables then don't use them. I'm don't see why finding a language that doesn't support them would offer any value. You're dealing wi ...
  • 要么使用Array.from : let rects = Array.from({length:3} , _=>({x: 32, y: 32, w: 32, h: 32})), i = 0, r; 或者使用传统的for循环: let rects = [], i = 0, r; for(let index = 0; index < 3; index++) rects[index] = {x: 32, y: 32, w: 32, h: 32}; Either use Array.from : let ...
  • 是的,它可以(但不仅仅是) 会话 。 有关更多详细信息,请参阅此CodeProject文章的解释很长。 请注意,它们与ASP.NET会话不同,它们可以将多个调用链接在一起(例如管理事务),但它可以很容易地用于存储数据。 这里只是一个非常简短的介绍作为快速参考。 要在WCF中配置会话,您应该设置以下三个元素: Binding , SessionMode和InstanceContextMode 。 并非所有协议都允许各种会话,例如:
    Node中的每个模块都有自己的范围,所以没有, var Foo; 不会创建全局变量Foo。 从模块内部使用global对象。 更新: require('http').createServer(function(req,res){ route(req,res,object); }).listen(cp=8080); object={variable:0} global.foo = 'Bar'; // I added this function route(req,res,object){ ...
  • 查看有关会话处理( MSDN )的WCF文档如果您正在处理原型,则可以构建静态字典,在该字典中可以将值与会话密钥一起转储 Check out the WCF Documentation about Session handling (MSDN) If you´re working on a prototype you can get along building a static dictionary, in which you can dump your values in combination wit ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)