天天看点

如何在WordPress中切换/转换自定义帖子类型

WordPress comes with five default post types, which are posts, pages, attachments, revisions and menus. Users can also create their own custom post types. This gives them power to create different types of content and display them differently on their websites. Recently we found a need to merge two custom post type into one for a client’s project. In this article, we will show you how to switch custom post types without writing any code. Suppose if you created a post and wanted to covert it into a page, or a vice-versa, then you would be able to do this by following this tutorial. If you want to switch from one custom post type to another, then you would be able to do that as well. Lastly, you will be convert multiple post types at once which will allow you to save a lot of time.

WordPress带有五种默认的帖子类型,分别是帖子,页面,附件,修订和菜单。 用户还可以创建自己的自定义帖子类型 。 这使他们能够创建不同类型的内容并在其网站上以不同的方式显示它们。 最近,我们发现有必要将两种自定义帖子类型合并为一个客户项目。 在本文中,我们将向您展示如何在不编写任何代码的情况下切换自定义帖子类型。 假设您创建了一个帖子并希望将其隐藏到页面中,反之亦然,那么您可以按照本教程进行操作。 如果您想从一种自定义帖子类型切换到另一种,那么您也可以做到这一点。 最后,您将一次转换多种帖子类型,这将节省大量时间。

影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

First thing you need to do is install and activate the Post Type Switcher plugin. Post Type Switcher adds an option to switch post type of a specific post by going to the post edit screen or manage posts area. On the edit screen of your post or another post type, you will see a drop down under the “Publish” meta box. Choose the post type you want to switch to and click the update button.

您需要做的第一件事是安装并激活Post Type Switcher插件。 帖子类型切换器添加了一个选项,可通过转到帖子编辑屏幕或管理帖子区域来切换特定帖子的帖子类型。 在帖子或其他帖子类型的编辑屏幕上,您将在“发布”元框下看到一个下拉列表。 选择您要切换到的帖子类型,然后单击更新按钮。

如何在WordPress中切换/转换自定义帖子类型

You can also quickly change an individual post’s type from the Quick Edit screen while viewing all posts:

您还可以在查看所有帖子时从“快速编辑”屏幕快速更改单个帖子的类型:

如何在WordPress中切换/转换自定义帖子类型

Post Type Switcher also allows you to switch post type for multiple posts by editing them in the bulk action mode. Follow these steps:

帖子类型切换器还允许您通过在批量操作模式下编辑多个帖子来切换它们的帖子类型。 跟着这些步骤:

  1. All Posts所有帖子
  2. Select the posts you want to change

    选择您要更改的帖子

  3. Edit and press the 编辑” ,然后按“ Apply button.应用”按钮。
  4. Now you will see all selected posts in quick edit mode. Review the posts you have selected and then change the post type as needed.

    现在,您将在快速编辑模式下看到所有选定的帖子。 查看您选择的帖子,然后根据需要更改帖子类型。

如何在WordPress中切换/转换自定义帖子类型

转换多种帖子类型高级模式 (Converting Multiple Post Types Advanced Mode)

Post Type Switcher is a quicker and a simpler solution. However, there might be situations where you would need to select post types in a particular category, tag, or post types with a particular post format. In such situations you can use Convert Post Types plugin. Install and activate this plugin. Upon activation, a new “Convert post types” menu item will appear under Tools. You will notice that it is a powerful plugin, which allows you to do so many things and select posts by filtering them into categories, parent pages, tags, etc.

邮政类型切换器是一种更快,更简单的解决方案。 但是,在某些情况下,您可能需要选择特定类别,标签或具有特定帖子格式的帖子类型的帖子类型。 在这种情况下,您可以使用“ 转换帖子类型”插件。 安装并激活此插件。 激活后,新的“转换帖子类型”菜单项将出现在“工具”下。 您会注意到它是一个功能强大的插件,通过它您可以按类别,父页面,标签等将其过滤,从而做很多事情并选择帖子。

如何在WordPress中切换/转换自定义帖子类型

If you ever wanted to switch a post to a page in WordPress, convert a page into a post, or merge two custom post types into one, then we hope that you found this article helpful. If you have any questions, then please leave them in the comments. If you have used other methods to convert post types in WordPress, then share it with us in the comments below.

如果您想在WordPress中将帖子切换到页面,将页面转换为帖子,或将两种自定义帖子类型合并为一种,那么我们希望本文对您有所帮助。 如有任何疑问,请保留在评论中。 如果您使用其他方法在WordPress中转换帖子类型,请在下面的评论中与我们分享。

翻译自: https://www.wpbeginner.com/plugins/how-to-convert-post-types/