Own content within the loop
-
I would like to ad my own content after the second category in the loop, but i don’t know PHP that well.
I have tryed to ad <?php $count++; ?> and <?php if ($count == 2) : ?>, but without luck.
If I just ad the content, it will show before every category in the loop.I’m really lost. Are there any sugetions?
This is how it lokks right now:<?php
function get_home_wide_cat( $cat_data ){
$count = 0 ;
$Cat_ID = $cat_data[‘id’];
$offset = $Posts_num = $order = $rand = ”;if( !empty($cat_data[‘number’]) )
$Posts_num = $cat_data[‘number’];if( !empty($cat_data[‘order’]) )
$order = $cat_data[‘order’];if( !empty($cat_data[‘offset’]) )
$offset = $cat_data[‘offset’];if( $order == ‘rand’) $rand =”&orderby=rand”;
$cat_query = new WP_Query(‘cat=’.$Cat_ID.’&no_found_rows=1&posts_per_page=’.$Posts_num.$rand.’&offset=’.$offset);
$cat_title = get_the_category_by_ID($Cat_ID);?>
<?php $count++; ?>
<?php if ($count == 2) : ?>
<section class=”cat-box wide-cat-box”>
<div class=”cat-box-content”>
<h2 class=”post-box-title”>Instagram</h2>
<!– my own content –>
</div>
</section>
<?php else : ?>
<section class=”cat-box wide-cat-box tie-cat-<?php echo $Cat_ID ?>”>
<!– loops of categories –>
</section><!– List Box –>
<?php endif; ?>
- The topic ‘Own content within the loop’ is closed to new replies.