adjacent post sort order by post title
<?php
$all_posts = new WP_Query(array(
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => -1
));
foreach($all_posts->posts as $key => $value) {
if($value->ID == $post->ID){
$nextID = $all_posts->posts[$key + 1]->ID;
$prevID = $all_posts->posts[$key - 1]->ID;
break;
}
}
?>
<?php if($prevID): ?>
<span class="prev">
<a href="<?= get_the_permalink($prevID) ?>" rel="prev"><?= get_the_title($prevID) ?></a>
</span>
<?php endif; ?>
<?php if($nextID): ?>
<span class="next">
<a href="<?= get_the_permalink($nextID) ?>" rel="next"><?= get_the_title($nextID) ?></a>
</span>
<?php endif; ?>
Also in PHP:
- base decode 64 php
- clear cache manually laravel
- connect mongodb with php
- curl_multi_exec
- $get url php
- Y-m-d H:
- DependencyResolver/RuleSet.php on line 84
- disable errors in php
- export html table data to excel in php
- PackageManifest.php line 131: Undefined index: name
- check if is in a string php
- ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first! Considering conflict mpm_worker for mpm_prefork: ERROR: Could not enable dependency mpm_prefork for php7.2, aborting
- TIME 24 FORMAT PHP
- check how much letter php
- doctrine where
- declare variable in view for loop laravel
- composer global in laravel means
- different elements of array php
- echo php dropdown from db and save it in a db
- AWS HTTP error: Error creating resource: [message] fopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
- composer set php version
- dynamic url laravel
- Format Month as a number php
- clear cache in laravel putty