WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#3119 closed enhancement (wontfix)

link_pages enhancement

Reported by: _ck_ Owned by:
Milestone: Priority: low
Severity: minor Version: 2.1
Component: Template Keywords:
Focuses: Cc:
PR Number:

Description

A simple addition and shuffling of link_page code could allow an easy enhancement to allow BOTH kinds of numbers and "next page" links and also formatting for the current page, wrappers, bolding, etc.

  • some visitors need heavy-duty prompting clues...

ie.


<< 1 2 [3] 4 5 >>


function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', $pagelink='%', $more_file='',$currentpage='%') {
	global $id, $page, $numpages, $multipage, $more, $pagenow;
	if ( $more_file != '' )
		$file = $more_file;
	else
		$file = $pagenow;
	if ( $multipage ) {
		echo $before;
		if ( 'next' || 'both' == $next_or_number ) {
			if ( $more ) {
				
				$i = $page - 1;
				if ( $i && $more ) {
					if ( '' == get_settings('permalink_structure') )
						echo '<a href="' . get_permalink() . '&amp;page=' . $i . '">'.$previouspagelink.'</a>';
					else
						echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
				}
			}
		}
		if ( 'number' || 'both' == $next_or_number ) {

			for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
				$j = str_replace('%',"$i",$pagelink);
				echo ' ';
				if ( ($i != $page) || ((!$more) && ($page==1)) ) {
					if ( '' == get_settings('permalink_structure') )
						echo '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
					else
						echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
				}
				else {echo str_replace('%',"$i",$currentpage);}
				if ( ($i != $page) || ((!$more) && ($page==1)) )
					echo $j.'</a>';
			}
			
		} 		
		if ( 'next' || 'both' == $next_or_number ) {
			if ( $more ) {
				
				$i = $page + 1;
				if ( $i <= $numpages && $more ) {
					if ( '' == get_settings('permalink_structure') )
						echo '<a href="'.get_permalink() . '&amp;page=' . $i . '">'.$nextpagelink.'</a>';
					else
						echo '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>';
				}
				
			}
		}		
	echo $after;		
	}
}

Change History (2)

#1 @Nazgul
12 years ago

  • Milestone set to 2.4 (future)

#2 @Nazgul
12 years ago

  • Milestone 2.4 (future) deleted
  • Resolution set to wontfix
  • Status changed from new to closed

No traction for almost a year, so closing as wontfix.

Feel free to reopen it if you have additional info/patches/comments/...

Note: See TracTickets for help on using tickets.