link_before and link_after from thee17. fixes #5652
git-svn-id: https://develop.svn.wordpress.org/trunk@9202 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6ad42ba48e
commit
d806f2e97d
@ -32,6 +32,10 @@
|
|||||||
* bookmarks.
|
* bookmarks.
|
||||||
* 'after' - Default is '</li>' (string). The html or text to append to each
|
* 'after' - Default is '</li>' (string). The html or text to append to each
|
||||||
* bookmarks.
|
* bookmarks.
|
||||||
|
* 'link_before' - Default is '' (string). The html or text to prepend to each
|
||||||
|
* bookmarks inside the <a> tag.
|
||||||
|
* 'link_after' - Default is '' (string). The html or text to append to each
|
||||||
|
* bookmarks inside the <a> tag.
|
||||||
* 'between' - Default is '\n' (string). The string for use in between the link,
|
* 'between' - Default is '\n' (string). The string for use in between the link,
|
||||||
* description, and image.
|
* description, and image.
|
||||||
* 'show_rating' - Default is 0 (integer). Whether to show the link rating.
|
* 'show_rating' - Default is 0 (integer). Whether to show the link rating.
|
||||||
@ -49,7 +53,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
|
|||||||
'show_updated' => 0, 'show_description' => 0,
|
'show_updated' => 0, 'show_description' => 0,
|
||||||
'show_images' => 1, 'show_name' => 1,
|
'show_images' => 1, 'show_name' => 1,
|
||||||
'before' => '<li>', 'after' => '</li>', 'between' => "\n",
|
'before' => '<li>', 'after' => '</li>', 'between' => "\n",
|
||||||
'show_rating' => 0
|
'show_rating' => 0, 'link_before' => '', 'link_after' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
$r = wp_parse_args( $args, $defaults );
|
$r = wp_parse_args( $args, $defaults );
|
||||||
@ -93,6 +97,8 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
|
|||||||
$target = ' target="' . $target . '"';
|
$target = ' target="' . $target . '"';
|
||||||
|
|
||||||
$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
|
$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
|
||||||
|
|
||||||
|
$output .= $link_before;
|
||||||
|
|
||||||
if ( $bookmark->link_image != null && $show_images ) {
|
if ( $bookmark->link_image != null && $show_images ) {
|
||||||
if ( strpos($bookmark->link_image, 'http') !== false )
|
if ( strpos($bookmark->link_image, 'http') !== false )
|
||||||
@ -103,6 +109,8 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
|
|||||||
|
|
||||||
if ($show_name) $output .= $name;
|
if ($show_name) $output .= $name;
|
||||||
|
|
||||||
|
$output .= $link_after;
|
||||||
|
|
||||||
$output .= '</a>';
|
$output .= '</a>';
|
||||||
|
|
||||||
if ( $show_updated && $bookmark->recently_updated )
|
if ( $show_updated && $bookmark->recently_updated )
|
||||||
|
@ -377,18 +377,51 @@ function sticky_class( $post_id = null ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@internal Missing Short Description}}
|
* Page Template Functions for usage in Themes
|
||||||
*
|
*
|
||||||
* {@internal Missing Long Description}}
|
* @package WordPress
|
||||||
|
* @subpackage Template
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The formatted output of a list of Pages.
|
||||||
|
*
|
||||||
|
* Displays page-links for paginated posts (i.e. includes the <!--nextpage--> Quicktag one or
|
||||||
|
* more times). This works in much the same way as link_pages(), the difference being that
|
||||||
|
* arguments are given in query string format. 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.
|
||||||
|
* 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 '<p> Pages:' (string). The html or text to prepend to each
|
||||||
|
* bookmarks.
|
||||||
|
* 'after' - Default is '</p>' (string). The html or text to append to each
|
||||||
|
* bookmarks.
|
||||||
|
* 'more_file' - Default is '' (string) Page the links should point to. Defaults to
|
||||||
|
* the current page.
|
||||||
|
* 'link_before' - Default is '' (string). The html or text to prepend to each
|
||||||
|
* Pages link inside the <a> tag.
|
||||||
|
* 'link_after' - Default is '' (string). The html or text to append to each
|
||||||
|
* Pages link inside the <a> tag.
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
|
* @access private
|
||||||
*
|
*
|
||||||
* @param unknown_type $args
|
* @param array $bookmarks List of bookmarks to traverse
|
||||||
* @return unknown
|
* @param string|array $args Optional. Overwrite the defaults.
|
||||||
|
* @return string Formatted output in HTML
|
||||||
*/
|
*/
|
||||||
function wp_link_pages($args = '') {
|
function wp_link_pages($args = '') {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'before' => '<p>' . __('Pages:'), 'after' => '</p>',
|
'before' => '<p>' . __('Pages:'), 'after' => '</p>',
|
||||||
|
'link_before' => '', 'link_after' => '',
|
||||||
'next_or_number' => 'number', 'nextpagelink' => __('Next page'),
|
'next_or_number' => 'number', 'nextpagelink' => __('Next page'),
|
||||||
'previouspagelink' => __('Previous page'), 'pagelink' => '%',
|
'previouspagelink' => __('Previous page'), 'pagelink' => '%',
|
||||||
'more_file' => '', 'echo' => 1
|
'more_file' => '', 'echo' => 1
|
||||||
@ -419,8 +452,11 @@ function wp_link_pages($args = '') {
|
|||||||
else
|
else
|
||||||
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
|
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$output .= $link_before;
|
||||||
$output .= $j;
|
$output .= $j;
|
||||||
|
$output .= $link_after;
|
||||||
if ( ($i != $page) || ((!$more) && ($page==1)) )
|
if ( ($i != $page) || ((!$more) && ($page==1)) )
|
||||||
$output .= '</a>';
|
$output .= '</a>';
|
||||||
}
|
}
|
||||||
@ -431,23 +467,23 @@ function wp_link_pages($args = '') {
|
|||||||
$i = $page - 1;
|
$i = $page - 1;
|
||||||
if ( $i && $more ) {
|
if ( $i && $more ) {
|
||||||
if ( 1 == $i ) {
|
if ( 1 == $i ) {
|
||||||
$output .= '<a href="' . get_permalink() . '">' . $previouspagelink . '</a>';
|
$output .= '<a href="' . get_permalink() . '">' . $link_before. $previouspagelink . $link_after . '</a>';
|
||||||
} else {
|
} else {
|
||||||
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
|
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
|
||||||
$output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $previouspagelink . '</a>';
|
$output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $link_before. $previouspagelink . $link_after . '</a>';
|
||||||
else
|
else
|
||||||
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $previouspagelink . '</a>';
|
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i = $page + 1;
|
$i = $page + 1;
|
||||||
if ( $i <= $numpages && $more ) {
|
if ( $i <= $numpages && $more ) {
|
||||||
if ( 1 == $i ) {
|
if ( 1 == $i ) {
|
||||||
$output .= '<a href="' . get_permalink() . '">' . $nextpagelink . '</a>';
|
$output .= '<a href="' . get_permalink() . '">' . $link_before. $nextpagelink . $link_after . '</a>';
|
||||||
} else {
|
} else {
|
||||||
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
|
if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
|
||||||
$output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $nextpagelink . '</a>';
|
$output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $link_before. $nextpagelink . $link_after . '</a>';
|
||||||
else
|
else
|
||||||
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $nextpagelink . '</a>';
|
$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$output .= $after;
|
$output .= $after;
|
||||||
|
Loading…
Reference in New Issue
Block a user