Joomla!, Wordpress tips for building your site

How to show top categories only with Wordpress

Published on| December 4th, 2009 | No Comment.

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.

<?php if (have_posts()) : while (have_posts()) :  the_post(); ?>

When you want to be displayed in the order they were posted only a certain category, this written before, only to be declared.

<?php query_posts('cat=4'); ?> 
 <?php if (have_posts()) : while (have_posts()) :  the_post(); ?>

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)





Comments

Leave a Reply








Transrator

Recent Posts

Categories

Tag Cloud

execute remove フロントページ 投稿ページ トップページ install WIndows Note Convert META generator 日付 donwload file manage multibyte utf-8 unicode shiftjis euc console サイトマップ 問題 ParmaLink Redirect パーマリンク はみ出る pre テンプレート テーマ タグクラウド マルチランゲージ リダイレクト PHP(タグ) タグ table control HTML(タグ) コマンド 国際化(翻訳) SQLite(タグ) MySQL(タグ) qTranslate プラグイン(タグ) Wordpress(タグ)

Links

Site Description

Joomla!, Wordpress as CMS using a site building, site management, software usage to describe the development tips.

  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ