简体   繁体   English

将自定义内容添加到Wordpress博客

[英]Adding custom content to a Wordpress blog

Is there a way in a Wordpress blog to get the admin side of Wordpress to add custom content in the database, that will not be anything related to posts or pages? Wordpress博客中是否有一种方法可以让Wordpress的管理员方在数据库中添加自定义内容,而该内容与帖子或页面无关?

It will just be a little bit of info such as date, title, description, and an image that I will use in a specific part of the front page. 这只是一些信息,例如日期,标题,描述以及我将在首页的特定部分中使用的图像。

Is wordpress too restrictive on this, will I have to use a different CMS? wordpress对此是否过于严格,是否需要使用其他CMS?

Edit: 编辑:

Could Custom Post Types be what I am looking for? 自定义帖子类型可以满足我的需求吗?

您应该将这些值存储在自定义字段中

Recent WP releases fully support custom types: http://codex.wordpress.org/Post_Types#Custom_Types 最新的WP版本完全支持自定义类型: http : //codex.wordpress.org/Post_Types#Custom_Types

This allows you to create a new, full-class data type that will have a new menu option below post and page. 这使您可以创建新的完整类数据类型,该类型将在发布和页面下方具有新的菜单选项。

Also, take a look at the More Types plugin (http://wordpress.org/extend/plugins/more-types/), which provides an easy and powerful GUI for doing this. 另外,请查看“更多类型”插件(http://wordpress.org/extend/plugins/more-types/),该插件提供了一个简单而强大的GUI来执行此操作。 Along with More Fields by the same author (http://wordpress.org/extend/plugins/more-fields/), WP becomes a pretty powerful CMS. 与同一作者的更多字段(http://wordpress.org/extend/plugins/more-fields/)一起,WP成为了功能非常强大的CMS。

"It will just be a little bit of info such as date, title, description, and an image that I will use in a specific part of the front page." “这只是一些信息,例如日期,标题,描述以及我将在首页的特定部分使用的图像。”

So, if I am reading this correctly, you want to create a custom post type, which describing what you are saying - "date, title, description, image" - this is basically a post ;) 因此,如果我正确阅读了这篇文章,您想创建一个自定义帖子类型,该帖子类型描述您在说什么-“日期,标题,描述,图像”-这基本上是一篇帖子;)

You can easily hook into the wordpress query object. 您可以轻松地挂钩到wordpress查询对象。

Eg 例如

$args = array(
    'post_type'=>'my_special_post',
    'posts_per_page'=>8
);
query_posts($args);

The the normal while posts applies. 正常的while帖子适用。 If you don't want it to be in within the post array, then nothing is stopping you from just creating your own queries which is well explained here: http://codex.wordpress.org/Custom_Queries . 如果您不希望它出现在post数组中,那么什么也不会阻止您仅创建自己的查询,这在下面进行了很好的解释: http : //codex.wordpress.org/Custom_Queries

I should add creating post types as well - they are easily configured in your functions.php file without need to add a plugin. 我还应该添加创建帖子类型-可以在您的functions.php文件中轻松配置它们,而无需添加插件。 Unless you want a more managed solution: http://codex.wordpress.org/Post_Types 除非您想要一个更加托管的解决方案,否则: http : //codex.wordpress.org/Post_Types

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM