Add paging to Manage->Posts. http://mosquito.wordpress.org/view.php?id=1177
git-svn-id: https://develop.svn.wordpress.org/trunk@2481 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7413ccfe72
commit
82d89d8d7c
@ -66,12 +66,21 @@ if ($drafts || $other_drafts) {
|
|||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2>
|
<h2>
|
||||||
<?php
|
<?php
|
||||||
if ( $_GET['m'] ) {
|
$what_to_show = 'posts';
|
||||||
echo $month[substr( $_GET['m'], 4, 2 )] . ' ' . substr( $_GET['m'], 0, 4 );
|
$posts_per_page = 15;
|
||||||
} elseif ( isset( $_GET['s'] ) ) {
|
$posts_per_archive_page = -1;
|
||||||
|
|
||||||
|
include(ABSPATH.'wp-blog-header.php');
|
||||||
|
|
||||||
|
if ( is_month() ) {
|
||||||
|
single_month_title(' ');
|
||||||
|
} elseif ( is_search() ) {
|
||||||
printf(__('Search for “%s”'), wp_specialchars($_GET['s']) );
|
printf(__('Search for “%s”'), wp_specialchars($_GET['s']) );
|
||||||
} else {
|
} else {
|
||||||
_e('Last 15 Posts');
|
if ( ! is_paged() || get_query_var('paged') == 1 )
|
||||||
|
_e('Last 15 Posts');
|
||||||
|
else
|
||||||
|
_e('Previous Posts');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</h2>
|
</h2>
|
||||||
@ -140,15 +149,6 @@ $posts_columns['control_delete'] = '';
|
|||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$what_to_show = 'posts';
|
|
||||||
if ( empty($_GET['m']) || 0 == $_GET['m'] && empty($_GET['s']) ) {
|
|
||||||
$showposts = 15;
|
|
||||||
} else {
|
|
||||||
$nopaging = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
include(ABSPATH.'wp-blog-header.php');
|
|
||||||
|
|
||||||
if ($posts) {
|
if ($posts) {
|
||||||
$bgcolor = '';
|
$bgcolor = '';
|
||||||
foreach ($posts as $post) { start_wp();
|
foreach ($posts as $post) { start_wp();
|
||||||
@ -238,6 +238,12 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
|||||||
} // end if ($posts)
|
} // end if ($posts)
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div class="navigation">
|
||||||
|
<div class="alignleft"><?php next_posts_link(__('« Previous Entries')) ?></div>
|
||||||
|
<div class="alignright"><?php previous_posts_link(__('Next Entries »')) ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( 1 == count($posts) ) {
|
if ( 1 == count($posts) ) {
|
||||||
|
|
||||||
|
@ -141,6 +141,14 @@ textarea, input, select {
|
|||||||
padding: 3px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.alignleft {
|
||||||
|
float: left
|
||||||
|
}
|
||||||
|
|
||||||
|
.alignright {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
.alternate {
|
.alternate {
|
||||||
background: #eee;
|
background: #eee;
|
||||||
}
|
}
|
||||||
@ -173,6 +181,13 @@ textarea, input, select {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navigation {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
.post-categories {
|
.post-categories {
|
||||||
display: inline;
|
display: inline;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -1395,6 +1395,12 @@ function is_trackback () {
|
|||||||
return $wp_query->is_trackback;
|
return $wp_query->is_trackback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_admin () {
|
||||||
|
global $wp_query;
|
||||||
|
|
||||||
|
return $wp_query->is_admin;
|
||||||
|
}
|
||||||
|
|
||||||
function is_home () {
|
function is_home () {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
@ -368,64 +368,65 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_pagenum_link($pagenum = 1){
|
function get_pagenum_link($pagenum = 1) {
|
||||||
global $wp_rewrite;
|
global $wp_rewrite;
|
||||||
|
|
||||||
$qstr = $_SERVER['REQUEST_URI'];
|
$qstr = $_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
$page_querystring = "paged";
|
$page_querystring = "paged";
|
||||||
$page_modstring = "page/";
|
$page_modstring = "page/";
|
||||||
$page_modregex = "page/?";
|
$page_modregex = "page/?";
|
||||||
$permalink = 0;
|
$permalink = 0;
|
||||||
$index = 'index.php';
|
//$index = 'index.php';
|
||||||
|
$index = $_SERVER['SCRIPT_NAME'];
|
||||||
|
|
||||||
$home_root = parse_url(get_settings('home'));
|
$home_root = parse_url(get_settings('home'));
|
||||||
$home_root = $home_root['path'];
|
$home_root = $home_root['path'];
|
||||||
$home_root = trailingslashit($home_root);
|
$home_root = trailingslashit($home_root);
|
||||||
$qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
|
$qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
|
||||||
$qstr = preg_replace('|^/+|', '', $qstr);
|
$qstr = preg_replace('|^/+|', '', $qstr);
|
||||||
|
|
||||||
// if we already have a QUERY style page string
|
// if we already have a QUERY style page string
|
||||||
if( stristr( $qstr, $page_querystring ) ) {
|
if( stristr( $qstr, $page_querystring ) ) {
|
||||||
$replacement = "$page_querystring=$pagenum";
|
$replacement = "$page_querystring=$pagenum";
|
||||||
$qstr = preg_replace("/".$page_querystring."[^\d]+\d+/", $replacement, $qstr);
|
$qstr = preg_replace("/".$page_querystring."[^\d]+\d+/", $replacement, $qstr);
|
||||||
// if we already have a mod_rewrite style page string
|
// if we already have a mod_rewrite style page string
|
||||||
} elseif ( preg_match( '|'.$page_modregex.'\d+|', $qstr ) ){
|
} elseif ( preg_match( '|'.$page_modregex.'\d+|', $qstr ) ){
|
||||||
$permalink = 1;
|
$permalink = 1;
|
||||||
$qstr = preg_replace('|'.$page_modregex.'\d+|',"$page_modstring$pagenum",$qstr);
|
$qstr = preg_replace('|'.$page_modregex.'\d+|',"$page_modstring$pagenum",$qstr);
|
||||||
|
|
||||||
// if we don't have a page string at all ...
|
// if we don't have a page string at all ...
|
||||||
// lets see what sort of URL we have...
|
// lets see what sort of URL we have...
|
||||||
} else {
|
} else {
|
||||||
// we need to know the way queries are being written
|
// we need to know the way queries are being written
|
||||||
// if there's a querystring_start (a "?" usually), it's deffinitely not mod_rewritten
|
// if there's a querystring_start (a "?" usually), it's definitely not mod_rewritten
|
||||||
if ( stristr( $qstr, '?' ) ){
|
if ( stristr( $qstr, '?' ) ){
|
||||||
// so append the query string (using &, since we already have ?)
|
// so append the query string (using &, since we already have ?)
|
||||||
$qstr .= '&' . $page_querystring . '=' . $pagenum;
|
$qstr .= '&' . $page_querystring . '=' . $pagenum;
|
||||||
// otherwise, it could be rewritten, OR just the default index ...
|
// otherwise, it could be rewritten, OR just the default index ...
|
||||||
} elseif( '' != get_settings('permalink_structure')) {
|
} elseif( '' != get_settings('permalink_structure') && ! is_admin()) {
|
||||||
$permalink = 1;
|
$permalink = 1;
|
||||||
|
$index = $wp_rewrite->index;
|
||||||
|
// If it's not a path info permalink structure, trim the index.
|
||||||
|
if (! $wp_rewrite->using_index_permalinks()) {
|
||||||
|
$qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
|
||||||
|
} else {
|
||||||
|
// If using path info style permalinks, make sure the index is in
|
||||||
|
// the URI.
|
||||||
|
if (strpos($qstr, $index) === false) {
|
||||||
|
$qstr = '/' . $index . $qstr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If it's not a path info permalink structure, trim the index.
|
$qstr = trailingslashit($qstr) . $page_modstring . $pagenum;
|
||||||
if (! $wp_rewrite->using_index_permalinks()) {
|
} else {
|
||||||
$qstr = preg_replace("#/*" . $index . "/*#", '/', $qstr);
|
$qstr = $index . '?' . $page_querystring . '=' . $pagenum;
|
||||||
} else {
|
}
|
||||||
// If using path info style permalinks, make sure the index is in
|
}
|
||||||
// the URI.
|
|
||||||
if (strpos($qstr, $index) === false) {
|
|
||||||
$qstr = '/' . $index . $qstr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$qstr = trailingslashit($qstr) . $page_modstring . $pagenum;
|
$qstr = preg_replace('|^/+|', '', $qstr);
|
||||||
} else {
|
if ($permalink) $qstr = trailingslashit($qstr);
|
||||||
$qstr = $index . '?' . $page_querystring . '=' . $pagenum;
|
return preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr );
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$qstr = preg_replace('|^/+|', '', $qstr);
|
|
||||||
if ($permalink) $qstr = trailingslashit($qstr);
|
|
||||||
return preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', trailingslashit( get_settings('home') ) . $qstr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function next_posts($max_page = 0) { // original by cfactor at cooltux.org
|
function next_posts($max_page = 0) { // original by cfactor at cooltux.org
|
||||||
|
Loading…
Reference in New Issue
Block a user