function first_post($format = true,$published){
$q = mysqli_query($GLOBALS["dblink"], "SELECT title,title_markup,permalink FROM wp_posts WHERE published < '".$published."' AND post_status = 'publish' ORDER BY published ASC LIMIT 1");
if(mysqli_num_rows($q)>0){
while($arr = mysqli_fetch_array($q)){
$uri = $arr['permalink'];
return ($format) ? "\n".''."\n" : ''.$arr['title_markup'].'';
}
}else{
return "\n";
}
}
function prev_post($format = true,$published){
$q = mysqli_query($GLOBALS["dblink"], "SELECT title,title_markup,permalink FROM wp_posts WHERE published < '".$published."' AND post_status = 'publish' ORDER BY published DESC LIMIT 1");
if(mysqli_num_rows($q)>0){
while($arr = mysqli_fetch_array($q)){
$uri = $arr['permalink'];
return ($format) ? ''."\n" : ''.$arr['title_markup'].'';
}
}
}
function next_post($format = true,$published){
$now = gmdate('Y-m-d H:i:s',time());
$q = mysqli_query($GLOBALS["dblink"], "SELECT title,title_markup,permalink FROM wp_posts WHERE published > '".$published."' AND published < '".$now."' AND post_status = 'publish' ORDER BY published ASC LIMIT 1");
if(mysqli_num_rows($q)>0){
while($arr = mysqli_fetch_array($q)){
$uri = $arr['permalink'];
return ($format) ? ''."\n" : ''.$arr['title_markup'].'';
}
}
}
function last_post($format = true,$published){
$q = mysqli_query($GLOBALS["dblink"], "SELECT title,title_markup,permalink FROM wp_posts WHERE published > '".$published."' AND post_status = 'publish' ORDER BY published DESC LIMIT 1");
if(mysqli_num_rows($q)>0){
while($arr = mysqli_fetch_array($q)){
$uri = $arr['permalink'];
return ($format) ? ''."\n" : ''.$arr['title_markup'].'';
}
}
}