使用自定义帖子类型和分类法创建电影评论网站结构?

发布于 2024-09-06 20:42:31 字数 805 浏览 8 评论 0原文

WordPress 3.0 刚刚发布,有人引用可以使用自定义帖子类型和分类法制作电影评论网站作为使用 WordPress 作为 CMS 的示例。我想尝试将其作为学习示例:我有编程经验,但没有 WP 经验。

基本上我正在寻找有关如何构建帖子类型、标签和分类类型内容的指导。我可以通过阅读 WordPress 文档来弄清楚如何做到这一点;我只是主要寻找示例场景的“作战计划”帮助。

作为一个小测试用例,我们假设只有 3 种类型的电影:动作片、戏剧和喜剧,并且我的数据库中每种类型都有 5 部电影。

在顶部导航栏上,我想要一个“流派”选项卡,在下拉菜单中显示 3 种电影流派。当单击其中一个时,我希望它转到该类型的页面(因此可能应该有一个“类型”自定义帖子类型),其中包含一些有关该类型的文本,然后显示 5 个类型的列表该类型的电影。

单击其中一部电影时,它应该转到该电影的页面(因此可能应该有一个“电影”自定义帖子类型),其中显示一些有关电影的文本,一些有关其类型的文本(因此此页面需要以某种方式知道它与什么类型相关),以及两个链接:一个链接到电影的照片,另一个链接链接到电影的评论。

当您单击图片时,它只会显示电影的一些图片(因此 moviePicture 或类似的图片应该是自定义帖子类型)。

当您单击“评论”时,它应该转到书面评论(因此 movieReview 应该是自定义帖子类型)

此外,假设主导航上有另一个选项卡,名为“电影”,它显示所有 15 部电影的列表,当您点击它,它会直接跳转到上面的“电影信息”页面(跳过类型步骤)。

呃...所以说我想设置类似的东西;熟悉 WP 3.0 的人可以帮助我提出与上述相对应的分类法、税收和帖子类型的正确结构吗?提前致谢!

Wordpress 3.0 just came out and it was cited that one can make a Movie Review site using custom post types and taxonomies as an example of using wordpress as a CMS. I want to try to do this as a learning example: I have experience programming but not with WP.

Basically I'm looking for guidance on how to structure the post types, tags and taxonomy type stuff. I can figure out HOW to do this from reading wordpress docs; I'm just mainly looking for "battle plan" help for an example scenario.

As a small test case let's assume there are only 3 genres of movies: Action, Drama, and Comedy, and that my database has 5 movies of each type.

On the top nav I'd want a "Genre" tab that would display the 3 movie genres in drop down. When one of these is clicked I'd like it to go to a page for the genre (so there should probably be a "genre" custom post type), that has some text about the genre and then a displays a list of the 5 movies in that genre.

When one of the movies is clicked it should go to a page for that movie (so there should probably be a "movie" custom post type) that display some text about the movie, some text about the genre its in (so this page needs to somehow know what genre its tied to), and two links: one to photos of the movie and one to a review of the movie.

When you click on Pictures it would just show some pictures for the movie (so moviePicture or some such should be a custom post type).

When you click on Review it should go to a written review (so movieReview should be a custom post type)

Also, let's say there is another tab on the main navigation just called "movies" that shows a list of all 15 movies and when you click on it, it jumps right to the "movie info" page above (skipping the genre step).

Whew...so say I want to set something up just like that; can someone whose familiar with WP 3.0 help me come up with the proper structure of taxonomies, tax, and post types that corresponds with the above? Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撩起发的微风 2024-09-13 20:42:31

当然。您走在正确的道路上,因为您似乎很清楚自定义帖子类型是什么以及它们的用途。不过,我认为您对自定义分类法没有正确的理解。

我想说你应该对“流派”进行自定义分类。这将允许您将电影分类为各种类型,而不会因链接帖子类型而增加任何(和不必要的)复杂性。使流派分层,您可以输入流派的分类描述,以便流派页面仍然可以描述流派并在其中列出这些帖子类型。

你看得懂的电影。不必担心为图像创建帖子类型,因为您可以将图像“附加”到任何可以使用可视化编辑器的帖子类型。您甚至可以显示这些图像的图库,并为每部电影设置帖子缩略图(电影海报)。

电影评论也应该是它自己的自定义帖子类型。您可能需要添加一个元框,为您提供电影的下拉列表,以便您可以轻松定义两个帖子之间的关系。

就导航选项卡而言,新的导航菜单管理应该可以让您相当轻松地做到这一点。

除了注册帖子类型和分类之外,这可能还涉及大量用于模板和自定义永久链接的高级代码。我强烈建议使用 Matt Wiebe 的“更智能的自定义帖子类型”增强功能:

http://somadesign .ca/projects/smarter-custom-post-types/

它可以解决许多不同的麻烦点,并使您的生活变得更轻松。

Certainly. You're on the right track, as you seem to have a good idea of what custom post types are and what they do. I don't think you have the right understanding of what a custom taxonomy is, though.

I would say you should make a custom taxonomy of "Genre". This will allow you to categorize movies into various genres without any added (and unnecessary) complexity that comes from linking post types. Make the genres hierarchical and you can enter a taxonomy description for the genres so that the genre page can still describe the genre and list those post types in it.

Movies you understand well. Don't worry about doing a post type for images, since you can 'attach' images to any post type that can use the visual editor. You can even display a gallery of those images, and set a post thumbnail (movie poster) for each movie.

Movie reviews should also be its own custom post type. You'll probably want to add a meta box that will give you a dropdown of the movies so you can easily define the relationship between the two posts.

As far as navigation tabs, the new nav menu administration should allow you to do that rather easily.

In addition to registering the post types and taxonomies, this is probably going to involve a good bit of advanced code for templating and custom permalinks. I highly recommend using Matt Wiebe's 'Smarter Custom Post Types' enhancement:

http://somadesign.ca/projects/smarter-custom-post-types/

It takes care of a lot of various trouble spots and will make your life way easier.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文