Skip to content
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update publish.php
  • Loading branch information
bloatware authored Oct 17, 2016
commit c0306993e1b4178db0fd100a0090003d0e83efc4
14 changes: 7 additions & 7 deletions textpattern/publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ function article($atts, $thing = null)

function doArticles($atts, $iscustom, $thing = null)
{
global $pretext, $prefs;
global $pretext, $prefs, $thispage;
extract($pretext);
extract($prefs);
$customFields = getCustomFields();
Expand Down Expand Up @@ -934,8 +934,6 @@ function doArticles($atts, $iscustom, $thing = null)
$pg = (!$pg) ? 1 : $pg;
$pgoffset = $offset + (($pg - 1) * $pageby);

global $thispage;

if (empty($thispage)) {
$grand_total = safe_count('textpattern', $where);
$total = $grand_total - $offset;
Expand All @@ -959,10 +957,12 @@ function doArticles($atts, $iscustom, $thing = null)
} else {
$pgoffset = $offset;
if ($pgonly) {
$grand_total = safe_count('textpattern', $where);
$total = $grand_total - $offset;
$numPages = ceil($total / $pageby);
return $numPages;
if (empty($thispage) || array_diff_key($atts, array('pgonly' => true))) {
$total = safe_count('textpattern', $where) - $offset;
return ceil($total / $pageby);
} else {
return $thispage['numPages'];
}
}
}

Expand Down