How to show top categories only with Wordpress
Usually, WordPress home page, either permanently display the page, it is able to choose either a list of recent posts.(Bottom left of the screen management Fixed- [Options])
In this case, the list of latest posts in all categories will be displayed in the order they were posted.
That, in the order you wish to display only the categories that were submitted, and works as follows.
Or perhaps home.php theme, home.php does not exist, index.php, and I think that is to display the page.
Among them, should have the following loop.
|
When you want to be displayed in the order they were posted only a certain category, this written before, only to be declared.
|
In this example, the category ID = 4 is declared to be viewed only.
It is easy.()
This "query_posts" You can also set various other parameters.
If enough of these cases, tags and other templates can be easily made with the API, by using this, you need one line.
Quite so useful, and know how to use, it can be easy.()
Category argument
From the specified ID to get the names and categories.
- cat (integer) – specify a category ID.
- category_name (string) – specifies the name of the category (possibly Japanese).
- category__and (array) – array of categories ID.From only get all contained in multiple categories specified.
- category__in (array) – array of categories ID.From only get one of included in multiple categories specified.
- category__not_in (array) – array of categories ID.Get only one post not even included in the specified category.
Tag argument
Get a post attached to the specified tag.
- tag (string) – specifies the Tagusuraggu.
- tag__and (array) – array of tag ID.Only get more than one post containing all the specified tags.
- tag__in (array) – array of tag ID.Posts containing only get one of the specified tag.
- tag_slug__and (array) – array of Tagusuraggu.Only get more than one post containing all the specified tags.
- tag_slug__in (array) – array of Tagusuraggu.Posts containing only get one of the specified tag.
From arguments
Submitted by the specified ID to obtain the name and author.
- author (integer) – Specifies the ID of the post.
- author_name (string) – a nickname given by (possibly Japanese).
From fixed page argument
To obtain a fixed page with the specified ID or name submitted.
- p (integer) – From ID.
- name (string) – post slug.
- page_id (integer) – fixed page ID.
- pagename (string) – fixed Pejisuraggu.
- showposts (integer) – number of posts to be printed.
Arguments on
Respectively, to get the posts that are posted during times that day.Negative values are invalid.
- hour (integer)
- minute (integer)
- second (integer)
- day (integer)
- monthnum (integer)
- year (integer)
Argument page
- paged (integer) – If several pages of the monthly index and archive pages by category, specify the number of pages to be displayed.
- posts_per_page (integer) – output to one page of posts.-1 If the output of all posts.
- order (ASC / DESC) – obtained by a sequence of pages.The default value is "DESC".
Offset argument
- offset (integer) – specify the number of posts get posted to skip from the beginning.
Sort parameter
- orderby (author, date, category, title, modified, modified, menu_order, parent, ID, rand)
You might also like:
Comments
Leave a Reply