escort sitesi alanya bayan escort manavgat bayan escort fethiye bayan escort kemer bayan escort didim bayan escort çanakkale bayan escort Aydın bayan escort muğla bayan escort tekirdağ bayan escort manisa bayan escort balıkesir bayan escort trabzon bayan escort elazığ bayan escort ordu bayan escort kütahya bayan escort ısparta bayan escort rize bayan escort maraş bayan escort yalova bayan escort giresun bayan escort yozgat bayan escort tokat bayan escort şanlıurfa bayan escort sivas bayan escort batman bayan escort erzurum bayan escort sinop bayan escort kırşehir bayan escort karaman bayan escort kırıkkale bayan escort bolu bayan escort amasya bayan escort niğde bayan escort uşak bayan escort edirne bayan escort çorum bayan escort osmaniye bayan escort zonguldak bayan escort van bayan escort erzincan bayan escort istanbul masaj ankara masaj izmir masaj bursa masaj antalya masaj adana masaj konya masaj şanlıurfa masaj gaziantep masaj kocaeli masaj mersin masaj diyarbakır masaj hatay masaj manisa masaj kayseri masaj samsun masaj balıkesir masaj maraş masaj van masaj aydın masaj tekirdağ masaj sakarya masaj denizli masaj muğla masaj adıyaman masaj afyon masaj ağrı masaj aksaray masaj amasya masaj ardahan masaj artvin masaj bartın masaj batman masaj bayburt masaj bilecik masaj bingöl masaj bitlis masaj bolu masaj burdur masaj çanakkale masaj çankırı masaj çorum masaj düzce masaj edirne masaj elazığ masaj erzincan masaj erzurum masaj eskişehir masaj giresun masaj gümüşhane masaj ığdır masaj ısparta masaj karabük masaj karaman masaj kastamonu masaj kilis masaj kırıkkale masaj kırklareli masaj kırşehir masaj uşak masaj kütahya masaj malatya masaj mardin masaj nevşehir masaj niğde masaj ordu masaj trabzon masaj osmaniye masaj rize masaj siirt masaj sinop masaj sivas masaj tokat masaj kayseri escort kayseri escort kıbrıs escort kilis escort konya escort konya escort konya escort malatya escort malatya escort malatya escort manisa escort gaziantep escort van escort tunceli escort bursa escort sivas escort siirt escort şanlıurfa escort bilecik escort samsun escort çanakkale escort istanbul escort ankara escort izmir escort izmir escort bursa escort antalya escort antalya escort adana escort kocaeli escort konya escort mersin escort şanlıurfa escort samsun escort diyarbakır escort hatay escort manisa escort balıkesir escort gaziantep escort sakarya escort tekirdağ escort kayseri escort eskişehir escort aydın escort van escort denizli escort kahramanmaraş escort izmit escort trabzon escort adıyaman escort afyon escort erzurum escort ordu escort bodrum escort bodrum escort malatya escort elazığ escort tokat escort sivas escort muğla escort aksaray escort amasya escort niğde escort batman escort kütahya escort çanakkale escort çankırı escort çorum escort düzce escort hakkari escort edirne escort yozgat escort zonguldak escort bingöl escort yalova escort uşak escort sinop escort şırnak escort rize escort muş escort nevşehir escort osmaniye escort bolu escort mardin escort kırşehir escort kastamonu escort giresun escort kırıkkale escort ısparta escort karabük escort karaman escort kibris escort hatay escort ağrı escort afyon escort antalya escort antalya escort ardahan escort artvin escort ankara escort balıkesir escort bartın escort ankara escort bayburt escort bitlis escort istanbul escort burdur escort

How to Display the Post by Category

In WordPress to display the posts in a template consider as easy. But in some of the cases if there is requirement to display the posts as per the category then it’s seems to be little different. In this tutorial we will show you how to display the posts as per the category.

//first define the taxonomy name using get_terms

<?php $terms = get_terms(array('lm_branch_state')); ?>

//start main foreach loop

foreach ( $terms as $term ) {
$args = array(
'post_type' => 'lm_branch_names',
'posts_per_page' => -1,
'tax_query' => array(
'taxonomy' => 'lm_branch_state',
'field' => 'id',
'terms' => $term->term_id
$postslist = get_posts( $args ); ?>
<div id="menu" class="tab-pane">
<div class="row">

//here display the category name

<div class="col-sm-12">
<div class="for-diver">
<div class="body-widget">
<h2 class="heading-title-new" id="#menu<?php echo $i; ?>"> <?php echo $term->name; ?></h2>

//display the posts in the inner loop

<?php foreach($postslist as $post){ setup_postdata($post); ?>
echo $content = ob_get_clean();?>
<div class="col-sm-3">
<div class="team-widget">
<div class="body-widget text-center">
<a href="<?php the_permalink(); ?>">
<?php if(has_post_thumbnail()) { ?>
<?php the_post_thumbnail('full'); ?>
<?php } ?>
<h3 class="name-title"><?php the_title(); ?></h3>
<?php the_content(); ?>
//end display the posts in the inner loop
<?php wp_reset_postdata(); } ?>

//end main foreach loop

<?php $ark++; } ?>
Find More Topics:

Get the client IP address using PHP
How To Auto Redirect Users After Logout In WordPress
How to Display the Post by Category
How to Create Our Own Shortcode in WordPress
How to Fix Internal Server Error on WordPress

2 thoughts on “How to Display the Post by Category

Comments are closed.