Template Tags/posts nav link

Материал из WordPress Wiki

Перейти к: навигация, поиск

Содержание

Description

Displays links for next and previous pages. Useful for providing "paged" navigation of index, category and archive pages.

For displaying next and previous post navigation on individual posts, see next_post_link() and previous_post_link().

Usage

%%% <?php posts_nav_link('sep','prelabel','nxtlabel'); ?> %%%

Note that since weblog posts are traditionally listed in reverse chronological order (with most recent posts at the top), there is some ambiguity in the definition of "next page". WordPress defines "next page" as the "next page toward the past". In WordPress 1.5, the default Kubrick theme addresses this ambiguity by labeling the "next page" link as "previous entries". See Example: Kubrick Theme Format.

Examples

Default Usage

By default, the posts_nav_link look like this:

« Previous PageNext Page »
<?php posts_nav_link(); ?>

In Centered DIV

Displays previous and next page links ("previous page · next page") centered on the page.

<div style="text-align:center;">
<?php posts_nav_link(' &#183; ', 'previous page', 'next page'); ?>
</div>

Using Images

<?php posts_nav_link(' ', '<img src="images/prev.jpg" />', '<img src="images/next.jpg" />'); ?>

Kubrick Theme Format

The Kubrick theme format for posts navigation.

<div class="navigation">
<div class="alignleft"><?php posts_nav_link('','','&laquo; Previous Entries') ?></div>
<div class="alignright"><?php posts_nav_link('','Next Entries &raquo;','') ?></div>
</div>

Customizing the Link Text

You can change the text in each of the links and in the text in between the links.

You can go back to the previous page or you can go forward to the next page.
<p><?php posts_nav_link(' or ', 'You can go back
 to the previous page', 'you can go 
forward to the next page'); ?>.</p>


Parameters

sep 
(string) Text displayed between the links.
  • Defaults to ' :: ' in 1.2.x.
  • Defaults to ' — ' in 1.5.
prelabel 
(string) Link text for the previous page.
  • Defaults to '<< Previous Page' in 1.2.x.
  • Defaults to '« Previous Page' in 1.5.
nxtlabel 
(string) Link text for the next page.
  • Defaults to 'Next Page >>' in 1.2.x.
  • Defaults to 'Next Page »' in 1.5

Related

Шаблон:Tag Post Tags

Шаблон:PHP Function Tag Footer

Реклама

Отзывы Регуляторы температуры форум. Информация о терморегуляторе и регуляторе температуры.
заказать дизайн интерьера Краснодар, в студии дизайна