navigation code
-
guys i have this code in my theme and i want to add this ‘order_by’ => ‘post_title’ how to do??
[code]
<?php $auto_load_same_cat= ot_get_option('auto_load_same_cat');if($auto_load_same_cat=='1'){?>
<div class="player-button">
<div class="prev-post same-cat"><?php next_post_link('%link','<i class="fa fa-chevron-left"></i>',TRUE,'') ; ?></div>
<div class="next-post same-cat"><?php previous_post_link('%link ','<i class="fa fa-chevron-right"></i>',TRUE,''); ?></div>
</div>
<?php
}else
if($auto_load_same_cat=='0' || $auto_load_same_cat=='' ){?>
<div class="player-button">
<?php
$test = "";
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$test .= ',' . $tag->slug;
}
}
$test = substr($test, 1);
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'tag' => $test,
);
$current_key = $next = $previous= '';
$tm_query = get_posts($args);
foreach ( $tm_query as $key => $post ) : setup_postdata( $post );
if($post->ID == get_the_ID()){$current_key = $key;}
endforeach;
$id_pre = ($tm_query[$current_key+1]->ID);
$id_nex = ($tm_query[$current_key-1]->ID);
if($id_pre!= ''){$next = get_permalink($tm_query[$current_key+1]->ID); }
if($id_nex!= ''){$previous = get_permalink($tm_query[$current_key-1]->ID);}
?>
<div class="post-nav">
<?php if($previous!=''){?><div class="next-post">" class="next maincolor1hover bordercolor1hover bgcolor-hover" ><i class="fa fa-chevron-right"></i></div><?php }?>
<?php if($next!=''){?><div class="prev-post">" class="prev maincolor1hover bordercolor1hover bgcolor-hover" ><i class="fa fa-chevron-left"></i></div><?php }?>
</div></div>[/code]
ty
The topic ‘navigation code’ is closed to new replies.