Move the category list to show under the home tabs
Hi folks, i have had a few messages asking how to move the categories directory from the homepage and display them in a new tab on the homepage next to "Just listed, Popular etc "
1) tpl-ads-home.php
find the following code under the left block comment and comment it out like so:
<!-- left block -->
<?php /*<div class="content_left">
<?php if ( $cp_options->home_layout == 'directory' ) { ?>
<div class="shadowblock_out">
<div class="shadowblock">
<h2 class="dotted"><?php _e( 'Ad Categories', APP_TD ); ?></h2>
<div id="directory" class="directory <?php cp_display_style( 'dir_cols' ); ?>">
<?php echo cp_create_categories_list( 'dir' ); ?>
<div class="clr"></div>
</div><!--/directory-->
</div><!-- /shadowblock -->
</div><!-- /shadowblock_out -->
<?php } ?>
*/ ?>
2) just below is the tab control, you will need to add a new <li> tag with a link to #block4 like so:
<div class="tabcontrol">
<ul class="tabnavig">
<li><a href="#block1"><span class="big"><?php _e( 'Just Listed', APP_TD ); ?></span></a></li>
<li><a href="#block2"><span class="big"><?php _e( 'Most Popular', APP_TD ); ?></span></a></li>
<li><a href="#block3"><span class="big"><?php _e( 'Random', APP_TD ); ?></span></a></li>
<li><a href="#block4"><span class="big"><?php _e( 'Categories', APP_TD ); ?></span></a></li>
</ul>
3) underneath tab 3
<!-- tab 3 -->
<div id="block3">
<div class="clr"></div>
<div class="undertab"><span class="big"><?php _e( 'Classified Ads', APP_TD ); ?> / <strong><span class="colour"><?php _e( 'Random', APP_TD ); ?></span></strong></span></div>
<?php
// show all random ads but make sure the sticky featured ads don't show up first
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
query_posts( array( 'post_type' => APP_POST_TYPE, 'ignore_sticky_posts' => 1, 'paged' => $paged, 'orderby' => 'rand' ) );
$total_pages = max( 1, absint( $wp_query->max_num_pages ) );
?>
<?php get_template_part( 'loop', 'ad_listing' ); ?>
<?php
if ( $total_pages > 1 ) {
$random_url = add_query_arg( array( 'sort' => 'random' ), $post_type_url );
?>
<div class="paging"><a href="<?php echo $random_url; ?>"> <?php _e( 'View More Ads', APP_TD ); ?> </a></div>
<?php } ?>
</div><!-- /block3 -->
we will need to start a new tab 4 and add the contents that we commented out earlier like so:
<!-- tab 3 -->
<div = id="block4">
<div class="clr"></div>
<?php if ($cp_options->home_layout == 'directory') { ?>
<div class="shadowblock_out">
<div class="shadowblock">
<h2 class="dotted"><?php _e('Ad Categories', APP_TD); ?></h2>
<div id="directory" class="directory <?php cp_display_style('dir_cols'); ?>">
<?php echo cp_create_categories_list('dir'); ?>
<div class="clr"></div>
</div><!--/directory-->
</div><!-- /shadowblock -->
</div><!-- /shadowblock_out -->
<?php } ?>
</div><!-- /block4 -->
should end up with a result like this
cats.jpg