adapazarı escort sakarya escort akyazı escort anal escort arifiye escort erenler escort ferizli escort geyve escort hendek escort karasu escort pamukova escort sapanca escort serdivan escort söğütlü escort taraklı escort sakarya escort sakarya escort
serdivan escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort ankara travesti webmaster forum hd porn nevşehir escort
ankara escort bayan ankara escort bayan ankara escort
arrange post alphabetical order wordpress Archives - Wpdevcodes
sakarya escort sakarya escort sakarya escort bayan sakarya escort bayan serdivan escort kayseri escort webmaster forum

Tag Archives: arrange post alphabetical order wordpress

Alphabetical order posts wordpress

To display the posts by alphabetical for each letter it’s very easy to do this. We can do this also through custom post type as well. In this tutorial we can learn how to display the posts by Alphabetical for Each Letter. Put the below codes in the file where you want to display the posts by Alphabetical for Each Letter on wordpress.

* Here we used it through custom post type.  The custom type is: “transaction“. Check the below code. You can edit  the custom post type as per the requirement.

<?php $alphs=array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
foreach($alphs as $alph) {
echo '<div class="group-sec">';
//echo $alph;
?>
<ul class="posts">
<?php
global $wpdb;
$request = $alph; // could be any letter you want
$results = $wpdb->get_results("
SELECT * FROM $wpdb->posts
WHERE post_title LIKE '$request%'
AND post_type = 'transaction'
AND post_status = 'publish';
");
//echo count($results);
//print_r($results);
if ( $results ) {
foreach ( $results as $key => $result ) {
?>
<li>
<h3>
<?php if($key==0){
echo $alph;
} ?></h3>
<section class="v-center">
<div>
<a href="<?php the_permalink(); ?>" id="<?php echo $result->ID; ?>"><?php echo $result->post_title; ?></a>
</div>
</section>
</li>
<?php }
} ?>
</ul>
<?php
echo '</div>';
}
?>

Display Posts by Alphabetical for Each Letter