mirror of
https://github.com/danpros/htmly.git
synced 2026-04-21 21:16:23 +05:30
Update functions.php
This commit is contained in:
parent
9f1c5b7d50
commit
e6e8a12b90
1 changed files with 2 additions and 60 deletions
|
|
@ -309,7 +309,7 @@ function find_post($year, $month, $name)
|
||||||
|
|
||||||
foreach ($posts as $index => $v) {
|
foreach ($posts as $index => $v) {
|
||||||
$arr = explode('_', $v['basename']);
|
$arr = explode('_', $v['basename']);
|
||||||
if (strpos($arr[0], "$year-$month") !== false && strtolower($arr[2]) === strtolower($name . '.md')) {
|
if (strpos($arr[0], "$year-$month") !== false && strtolower($arr[2]) === strtolower($name . '.md') || strtolower($arr[2]) === strtolower($name . '.md')) {
|
||||||
|
|
||||||
// Use the get_posts method to return
|
// Use the get_posts method to return
|
||||||
// a properly parsed object
|
// a properly parsed object
|
||||||
|
|
@ -318,35 +318,6 @@ function find_post($year, $month, $name)
|
||||||
$nx = get_posts($posts, $index, 1);
|
$nx = get_posts($posts, $index, 1);
|
||||||
$pr = get_posts($posts, $index + 2, 1);
|
$pr = get_posts($posts, $index + 2, 1);
|
||||||
|
|
||||||
if ($index == 0) {
|
|
||||||
if (isset($pr[0])) {
|
|
||||||
return array(
|
|
||||||
'current' => $ar[0],
|
|
||||||
'prev' => $pr[0]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return array(
|
|
||||||
'current' => $ar[0],
|
|
||||||
'prev' => null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} elseif (count($posts) == $index + 1) {
|
|
||||||
return array(
|
|
||||||
'current' => $ar[0],
|
|
||||||
'next' => $nx[0]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return array(
|
|
||||||
'current' => $ar[0],
|
|
||||||
'next' => $nx[0],
|
|
||||||
'prev' => $pr[0]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else if (strtolower($arr[2]) === strtolower($name)) {
|
|
||||||
$ar = get_posts($posts, $index + 1, 1);
|
|
||||||
$nx = get_posts($posts, $index, 1);
|
|
||||||
$pr = get_posts($posts, $index + 2, 1);
|
|
||||||
|
|
||||||
if ($index == 0) {
|
if ($index == 0) {
|
||||||
if (isset($pr[0])) {
|
if (isset($pr[0])) {
|
||||||
return array(
|
return array(
|
||||||
|
|
@ -382,7 +353,7 @@ function find_draft($year, $month, $name)
|
||||||
|
|
||||||
foreach ($posts as $index => $v) {
|
foreach ($posts as $index => $v) {
|
||||||
$arr = explode('_', $v['basename']);
|
$arr = explode('_', $v['basename']);
|
||||||
if (strpos($arr[0], "$year-$month") !== false && strtolower($arr[2]) === strtolower($name . '.md')) {
|
if (strpos($arr[0], "$year-$month") !== false && strtolower($arr[2]) === strtolower($name . '.md') || strtolower($arr[2]) === strtolower($name . '.md')) {
|
||||||
|
|
||||||
// Use the get_posts method to return
|
// Use the get_posts method to return
|
||||||
// a properly parsed object
|
// a properly parsed object
|
||||||
|
|
@ -391,35 +362,6 @@ function find_draft($year, $month, $name)
|
||||||
$nx = get_posts($posts, $index, 1);
|
$nx = get_posts($posts, $index, 1);
|
||||||
$pr = get_posts($posts, $index + 2, 1);
|
$pr = get_posts($posts, $index + 2, 1);
|
||||||
|
|
||||||
if ($index == 0) {
|
|
||||||
if (isset($pr[0])) {
|
|
||||||
return array(
|
|
||||||
'current' => $ar[0],
|
|
||||||
'prev' => $pr[0]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return array(
|
|
||||||
'current' => $ar[0],
|
|
||||||
'prev' => null
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} elseif (count($posts) == $index + 1) {
|
|
||||||
return array(
|
|
||||||
'current' => $ar[0],
|
|
||||||
'next' => $nx[0]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return array(
|
|
||||||
'current' => $ar[0],
|
|
||||||
'next' => $nx[0],
|
|
||||||
'prev' => $pr[0]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else if (strtolower($arr[2]) === strtolower($name)) {
|
|
||||||
$ar = get_posts($posts, $index + 1, 1);
|
|
||||||
$nx = get_posts($posts, $index, 1);
|
|
||||||
$pr = get_posts($posts, $index + 2, 1);
|
|
||||||
|
|
||||||
if ($index == 0) {
|
if ($index == 0) {
|
||||||
if (isset($pr[0])) {
|
if (isset($pr[0])) {
|
||||||
return array(
|
return array(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue