Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Show tabs: Just listed | Featured | Popular | Categories

  1. #1
    Thread Starter
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts

    Show tabs: Just listed | Featured | Popular | Categories

    Hi,

    The goal of this tutorial is to change the tabs on the index page for ClassiPress (Version 3.1.8 & 3.1.9)

    Standard is Just listed | Featured Listings | Random

    After the changes you will get: Just listed | Featured Listing | Most Popular | Categories like shown on the following screenshot:

    [CENTER]tabs-vers-318.jpg[/CENTER]

    As you can see "Random" and its content is replaced by "Most Popular". Additional your visitors can open the ad categories.

    PART 1.)

    Lets start and backup the following files:
    - index.php in /wp-content/themes/classipress/
    - archive-ad_listing.php in /wp-content/themes/classipress/

    Done? OK, first open the index.php and find (it starts around line 45):

    PHP Code:
             <div class="tabcontrol">

                <ul class="tabnavig">
                  <li><a href="#block1"><span class="big"><?php _e('Just Listed','appthemes')?></span></a></li>
                  <li><a href="#block2"><span class="big"><?php _e('Most Popular','appthemes')?></span></a></li>
                  <li><a href="#block3"><span class="big"><?php _e('Random','appthemes')?></span></a></li>
                </ul>
                
            <?php remove_action'appthemes_after_endwhile''cp_do_pagination' ); ?>
          <?php $post_type_url get_bloginfo('url').'/'.get_option('cp_post_type_permalink').'/'?>

                <!-- tab 1 -->
                <div id="block1">

                  <div class="clr"></div>

                  <div class="undertab"><span class="big"><?php _e('Classified Ads','appthemes'?> / <strong><span class="colour"><?php _e('Just Listed','appthemes'?></span></strong></span></div>

                    <?php
                        
    // show all 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) );
                global 
    $wp_query;
                
    $total_pages max1absint$wp_query->max_num_pages ) );
                    
    ?>

                    <?php get_template_part'loop''ad_listing' ); ?>

            <?php
                
    if( $total_pages ){ ?>
                <div class="paging"><a href="<?php echo $post_type_url?>page/2/"> <?php _e'View More Ads''appthemes' ); ?> </a></div>
                <?php ?>

                </div><!-- /block1 -->



                <!-- tab 2 -->
                <div id="block2">

                  <div class="clr"></div>

                  <div class="undertab"><span class="big"><?php _e('Classified Ads','appthemes'?> / <strong><span class="colour"><?php _e('Most Popular','appthemes'?></span></strong></span></div>

            <?php get_template_part'loop''featured' ); ?>

            <?php global $cp_has_next_page?>
            <?php if($cp_has_next_page){ ?>
                <div class="paging"><a href="<?php echo $post_type_url?>page/2/?sort=popular"> <?php _e'View More Ads''appthemes' ); ?> </a></div>
            <?php ?>

            <?php wp_reset_query(); ?>

                </div><!-- /block2 -->


                <!-- tab 3 -->
                <div id="block3">

                  <div class="clr"></div>

                  <div class="undertab"><span class="big"><?php _e('Classified Ads','appthemes'?> / <strong><span class="colour"><?php _e('Random','appthemes'?></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') );
                global 
    $wp_query;
                
    $total_pages max1absint$wp_query->max_num_pages ) );
                    
    ?>

                    <?php get_template_part'loop''ad_listing' ); ?>

            <?php
                
    if( $total_pages ){ ?>
                <div class="paging"><a href="<?php echo $post_type_url?>page/2/?sort=random"> <?php _e'View More Ads''appthemes' ); ?> </a></div>
                <?php ?>

                </div><!-- /block3 -->

              </div><!-- /tabcontrol -->
    Replace the above code with the following:

    PHP Code:
            <div class="tabcontrol">

                <ul class="tabnavig">
                  <li><a href="#block1"><span class="big"><?php _e('Just Listed','appthemes')?></span></a></li>
                  <li><a href="#block2"><span class="big"><?php _e('Featured Listings','appthemes')?></span></a></li>
                  <li><a href="#block3"><span class="big"><?php _e('Most Popular','appthemes')?></span></a></li>
                  <li><a href="#block4"><span class="big"><?php _e('Categories','appthemes')?></span></a></li>
                </ul>
                
            <?php remove_action'appthemes_after_endwhile''cp_do_pagination' ); ?>
          <?php $post_type_url get_bloginfo('url').'/'.get_option('cp_post_type_permalink').'/'?>

                <!-- tab 1 -->
                <div id="block1">

                  <div class="clr"></div>

                  <div class="undertab"><span class="big"><?php _e('Classified Ads','appthemes'?> / <strong><span class="colour"><?php _e('Just Listed','appthemes'?></span></strong></span></div>

                    <?php
                        
    // show all 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) );
                global 
    $wp_query;
                
    $total_pages max1absint$wp_query->max_num_pages ) );
                    
    ?>

                    <?php get_template_part'loop''ad_listing' ); ?>

            <?php
                
    if( $total_pages ){ ?>
                <div class="paging"><a href="<?php echo $post_type_url?>page/2/"> <?php _e'View More Ads''appthemes' ); ?> </a></div>
                <?php ?>

                </div><!-- /block1 -->



                <!-- tab 2 -->
                <div id="block2">

                  <div class="clr"></div>

                  <div class="undertab"><span class="big"><?php _e('Classified Ads','appthemes'?> / <strong><span class="colour"><?php _e('Featured Listings','appthemes'?></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' => 'ad_listing''ad_cat' => $term->slug'caller_get_posts' => 1'post__in' => get_option('sticky_posts'), 'paged' => $paged,));
     
                    
    ?>
                    <?php get_template_part'loop''ad_listing' ); ?>

            <?php
                
    if( $total_pages ){ ?>
                <div class="paging"><a href="<?php echo $post_type_url?>page/2/?featured=1"> <?php _e'View More Ads''appthemes' ); ?> </a></div>
                <?php ?>

                </div><!-- /block2 -->


                <!-- tab 3 -->
                <div id="block3">

                  <div class="clr"></div>

                  <div class="undertab"><span class="big"><?php _e('Classified Ads','appthemes'?> / <strong><span class="colour"><?php _e('Most Popular','appthemes'?></span></strong></span></div>

            <?php get_template_part'loop''featured' ); ?>

            <?php global $cp_has_next_page?>
            <?php if($cp_has_next_page){ ?>
                <div class="paging"><a href="<?php echo $post_type_url?>page/2/?sort=popular"> <?php _e'View More Ads''appthemes' ); ?> </a></div>
            <?php ?>

            <?php wp_reset_query(); ?>

                </div><!-- /block3 -->


                <!-- tab 4 -->
                <div id="block4">
                  <div class="clr"></div>
     
                  <div class="undertab"><span class="big"><?php _e('Classified Ads','appthemes'?> / <strong><span class="colour"><?php _e('Categories','appthemes')?></span></strong></span></div>
     
                  <div class="shadowblock_out">
     
                        <div class="shadowblock">
     
                            <h2 class="dotted"><?php _e('Ad Categories','appthemes')?></h2>
     
                            <div id="directory" class="directory <?php if(get_option('cp_cat_dir_cols') == 2) echo 'two'?>Col">
     
                                <?php echo cp_cat_menu_drop_down(get_option('cp_cat_dir_cols'), get_option('cp_dir_sub_num')); ?>
     
                                <div class="clr"></div>
     
                            </div><!--/directory-->
     
                        </div><!-- /shadowblock -->
     
                    </div><!-- /shadowblock_out -->

                </div><!-- /block4 -->
              </div><!-- /tabcontrol -->
    save the file.

    Part 2 in the next posting
    Rolf Hassel (Samcy)

  2. #2
    Thread Starter
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Rolf Hassel (Samcy)

  3. The Following 7 Users Say Thank You to samcy For This Useful Post:

    alabasta79 (November 30th, 2012), budihartono (January 22nd, 2013), escortlove (August 3rd, 2012), Fanatic (December 29th, 2012), manamaga (July 25th, 2012), mzaha (October 24th, 2012), weiching (July 27th, 2012)

  4. #3
    manamaga's Avatar
    Join Date
    May 2012
    Location
    United Kingdom
    Posts
    511
    Thanks
    9
    Thanked 14 Times in 13 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    Thread Starter
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Rolf Hassel (Samcy)

  6. The Following User Says Thank You to samcy For This Useful Post:

    inspired (January 2nd, 2013)

  7. #5
    manamaga's Avatar
    Join Date
    May 2012
    Location
    United Kingdom
    Posts
    511
    Thanks
    9
    Thanked 14 Times in 13 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #6
    Junior Member muxmkt's Avatar
    Join Date
    Jul 2012
    Posts
    27
    Thanks
    2
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #7
    Junior Member marinos's Avatar
    Join Date
    Apr 2011
    Location
    Cyprus
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. #8
    escortlove's Avatar
    Join Date
    Aug 2012
    Posts
    90
    Thanks
    10
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  11. #9
    Newbie fazcom's Avatar
    Join Date
    Jan 2011
    Location
    Malaysia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  12. #10
    Junior Member alabasta79's Avatar
    Join Date
    Nov 2011
    Posts
    22
    Thanks
    7
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [TUTORIAL] Show tabs: Just listed | Featured | Popular | Categories (vers. 3.1.8)
    By samcy in forum ClassiPress General Discussion
    Replies: 13
    Last Post: July 25th, 2012, 02:29 PM
  2. Replies: 1
    Last Post: February 22nd, 2011, 11:18 AM
  3. how to change - Just Listed - Most Popular - Random Tabs
    By togitron in forum ClassiPress General Discussion
    Replies: 9
    Last Post: August 15th, 2010, 02:30 AM
  4. Replies: 7
    Last Post: July 20th, 2010, 11:26 AM
  5. Just Listed - Most Popular - Random Tabs
    By tbase in forum ClassiPress General Discussion
    Replies: 3
    Last Post: June 13th, 2010, 02:53 AM