wp_link_pages [ WordPress Function ]
| Access: |
|
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
The formatted output of a list of pages.
Displays page links for paginated posts (i.e. includes the . Quicktag one or more times). This tag must be within The Loop.
The defaults for overwriting are: 'next_or_number' - Default is 'number' (string). Indicates whether page numbers should be used. Valid values are number and next. 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page. of the bookmark. 'previouspagelink' - Default is 'Previous Page' (string). Text for link to previous page, if available. 'pagelink' - Default is '%' (String).Format string for page numbers. The % in the parameter string will be replaced with the page number, so Page % generates "Page 1", "Page 2", etc. Defaults to %, just the page number. 'before' - Default is '
Pages:' (string). The html or text to prepend to each bookmarks. 'after' - Default is '
' (string). The html or text to append to each bookmarks. 'link_before' - Default is '' (string). The html or text to prepend to each Pages link inside the tag. Also prepended to the current item, which is not linked. 'link_after' - Default is '' (string). The html or text to append to each Pages link inside the tag. Also appended to the current item, which is not linked.
Source
<?php
function wp_link_pages($args = '') {
$defaults = array(
'before' => '<p>' . __('Pages:'), 'after' => '</p>',
'link_before' => '', 'link_after' => '',
'next_or_number' => 'number', 'nextpagelink' => __('Next page'),
'previouspagelink' => __('Previous page'), 'pagelink' => '%',
'echo' => 1
);
$r = wp_parse_args( $args, $defaults );
$r = apply_filters( 'wp_link_pages_args', $r );
extract( $r, EXTR_SKIP );
global $page, $numpages, $multipage, $more, $pagenow;
$output = '';
if ( $multipage ) {
if ( 'number' == $next_or_number ) {
$output .= $before;
for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
$j = str_replace('%',$i,$pagelink);
$output .= ' ';
if ( ($i != $page) || ((!$more) && ($page==1)) ) {
$output .= _wp_link_page($i);
}
$output .= $link_before . $j . $link_after;
if ( ($i != $page) || ((!$more) && ($page==1)) )
$output .= '</a>';
}
$output .= $after;
} else {
if ( $more ) {
$output .= $before;
$i = $page - 1;
if ( $i && $more ) {
$output .= _wp_link_page($i);
$output .= $link_before. $previouspagelink . $link_after . '</a>';
}
$i = $page + 1;
if ( $i <= $numpages && $more ) {
$output .= _wp_link_page($i);
$output .= $link_before. $nextpagelink . $link_after . '</a>';
}
$output .= $after;
}
}
}
if ( $echo )
echo $output;
return $output;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- wp_link_pages() - WordPress Codex
Description. Displays page-links for paginated posts (i.e. includes the <!-- nextpage--> Quicktag one or more times). This works in much the same way as ...
codex.wordpress.org - WordPress › Support » wp_link_pages
Member Posted 6 years ago #. Hi,. Trying to make my pages XHTML valid. I am using the following: <?php wp_link_pages('before=<p>Pages:<span ...
wordpress.org - A Better wp_link_pages() for WordPress | bavotasan.com
May 3, 2012 ... If you've written a long post, WordPress provides the quicktag so you can divide it into multiple pages. All you need to do is make s...
bavotasan.com - functions - How to style current page number (wp_link_pages ...
Apr 10, 2011 ... When a post is split on more pages TwentyTen theme use the native function wp_link_pages to display a navigation page bar at the end of post ...
wordpress.stackexchange.com
Gebruikersdiscussies [ wordpress.org ]
- gusleig on "Check Which Post Page am I"
- alchymyth on "Check Which Post Page am I"
- gusleig on "Check Which Post Page am I"
- alchymyth on "Check Which Post Page am I"
- gusleig on "Check Which Post Page am I"
- fashion2012 on "wp_link_pages: Link current/active page to top of page"
- lwynne on "wp_link_pages: Link current/active page to top of page"
- kato on "Using Images with wp_link_pages"
- gbaka on "wp_link_pages ger rid of default"
- JRiley21 on "Using Images with wp_link_pages"