Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5831
    mylove007
    Participant

    Hi
    thanks for this wonderful plugin it save lot of time of us.

    i have one query
    i have making listing site

    url is
    http://restaurants.thebusinessrank.com/listingcategory/restaurants-in-agra/

    im using
    Tevolution-Directory

    i have to order this listing(post) max view to lowest view
    you say rank wise

    what is query to add and where in which file
    thanks in advance

    #5832
    Bartosz
    Keymaster

    If you’re doing a custom WP_Query just add ‘orderby’ => ‘post_views’ to your query parameters. If you’d like to modify the main query just use pre_get_posts filter and set the orderby arg to ‘post_views”.

    Basically you work with it that exactly the same way as you’d with normal query parameters and the plugins handles all the dirty work for you.

    #5833
    mylove007
    Participant

    this is the code i not get any of the line mention below please help me im very thank full to you

    <?php
    /**
     * Directory Category taxonomy page
     *
    **/
    get_header(); //Header Portion
    $tmpdata = get_option('templatic_settings');
    global $posts,$htmlvar_name;
    ?>
    <script type="text/javascript">
    var category_map = '<?php echo $tmpdata['category_map'];?>';
    <?php if($_COOKIE['display_view']=='event_map' && $tmpdata['category_map']=='yes'):?>
    jQuery(function() {			
    	jQuery('#listpagi').hide();
    });
    <?php endif;?>
    </script>
    <?php 
    do_action('after_directory_header');
    
     /*do action for display the breadcrumb in between header and container. */
     do_action('directory_before_container_breadcrumb'); ?>
    <div id="content" class="contentarea <?php directory_class();?>">
    	
    	<?php do_action('directory_inside_container_breadcrumb'); /*do action for display the breadcrumb  inside the container. */ ?>
         
        <div class="view_type_wrap">
         <?php
    	 /* Hooks for category title */
    	 do_action('directory_before_categories_title'); ?>
         
    	 <h1 class="loop-title"><?php single_cat_title(); ?></h1>
        
    	 <?php do_action('directory_after_categories_title'); 
         /* Hooks for category title end */
         
    	  /* Hooks for category description */
    	 do_action('directory_before_categories_description'); 
    
    	 if ( category_description() ) : /* Show an optional category description */ ?>
              <div class="archive-meta"><?php echo category_description(); ?></div>
         <?php endif; 
    
    	 do_action('directory_after_categories_description');
    	  /* Hooks for category description */
    	 ?>
         
         <?php do_action('directory_before_subcategory');
    	 
    		do_action('directory_subcategory');
    			/* Loads the sidebar-before-content. */
    			if(function_exists('supreme_sidebar_before_content'))
    		   apply_filters('tmpl_before-content',supreme_sidebar_before_content() ); 
    		   
    		do_action('directory_after_subcategory');
    	 ?>
        </div>
         <!--Start loop taxonomy page-->
       
       <?php do_action('directory_before_loop_taxonomy');?>
         <?php 
    
    /*
    add_filter('posts_orderby', 'views_posts_listing_custom' );
    
    function views_posts_listing_custom( $orderby )
    {
    global $wpdb,$wp_query,$post;
    $orderby="(SELECT SUM( count ) AS views
    FROM wp_i2b6c5t1_post_views, wp_i2b6c5t1_posts
    WHERE wp_i2b6c5t1_posts.ID = wp_i2b6c5t1_post_views.id
    AND TYPE =4
    GROUP BY wp_i2b6c5t1_post_views.id DESC");
     // $orderby=" (SELECT distinct $wpdb->postmeta.meta_value from $wpdb->postmeta where ($wpdb->posts.ID = $wpdb->postmeta.post_id) AND $wpdb-//>postmeta.meta_key = 'viewed_count' ) DESC";
      return $orderby;
    }
    */
    
    ?>
        <!--Start loop taxonomy page-->
        <div id="loop_listing_taxonomy" class="<?php if(isset($tmpdata['default_page_view']) && $tmpdata['default_page_view']=="gridview"){echo 'grid';}else{echo 'list';}?>" <?php if( is_plugin_active('Tevolution-Directory/directory.php') && isset($tmpdata['default_page_view']) && $tmpdata['default_page_view']=="mapview"){ echo 'style="display: none;"';}?>>
    
        <?php if (have_posts()) : 
    			while (have_posts()) : the_post(); ?>
    
    				<?php do_action('directory_before_post_loop');?>
    				 
    				<div class="post <?php templ_post_class();?>" >  
    					<?php 
    					/* Hook to display before image */	
    					do_action('directory_before_category_page_image');
    						
    					/* Hook to Display Listing Image  */
    					do_action('directory_category_page_image');
    					 
    					/* Hook to Display After Image  */						 
    					do_action('directory_after_category_page_image'); 
    					   
    					/* Before Entry Div  */	
    					do_action('directory_before_post_entry');?> 
    					
    					<!-- Entry Start -->
    					<div class="entry"> 
    					   
    						<?php  /* do action for before the post title.*/ 
    						do_action('directory_before_post_title');         ?>
    					   <div class="listing-wrapper">
    						<!-- Entry title start -->
    						<div class="entry-title">
    					   
    						<?php do_action('templ_post_title');                /* do action for display the single post title */?>
    					   
    						</div>
    						
    						<?php do_action('directory_after_post_title');          /* do action for after the post title.*/?>
    					   
    						<!-- Entry title end -->
    						
    						<!-- Entry details start -->
    						<div class="entry-details">
    						
    						<?php  /* Hook to get Entry details - Like address,phone number or any static field  */  
    						do_action('listing_post_info');   ?>     
    						
    						</div>
    						<!-- Entry details end -->
    					   </div>
    
    						<!--Start Post Content -->
    						<?php /* Hook for before post content . */ 
    					   
    						do_action('directory_before_post_content'); 
    						
    						/* Hook to display post content . */ 
    						do_action('templ_taxonomy_content');
    					   
    						/* Hook for after the post content. */
    						do_action('directory_after_post_content'); 
    						?>
    						<!-- End Post Content -->
    					   <?php 
    					    /* Hook for before listing categories     */
    						do_action('directory_before_taxonomies');
    					    
    						/* Display listing categories     */
    					    do_action('templ_the_taxonomies'); 
    
    						/* Hook to display the listing comments, add to favorite and pinpoint   */						
    						do_action('directory_after_taxonomies');?>
    					</div>
    					<!-- Entry End -->
    					<?php do_action('directory_after_post_entry');?>
    				</div>
    			<?php do_action('directory_after_post_loop');
              	endwhile;
    			wp_reset_query(); 
    		else:?>
              	<p class='nodata_msg'><?php _e( 'Apologies, but no results were found for the requested archive.', DIR_DOMAIN ); ?></p>              
            <?php endif; ?>
         </div>
        <?php do_action('directory_after_loop_taxonomy');
    	 
    	if(function_exists('supreme_sidebar_after_content'))
    		apply_filters('tmpl_after-content',supreme_sidebar_after_content());  /* after-content-sidebar - use remove filter to don't display it */
    	/* pagination start */
    	if($wp_query->max_num_pages !=1):?>
    	<div id="listpagi">
    		<div class="pagination pagination-position">
    			<?php if(function_exists('pagenavi_plugin')) { pagenavi_plugin(); } ?>
    		</div>
    	</div>
        <?php endif; /* pagination end */?>
          <!--End loop taxonomy page -->
    </div>
    <!--taxonomy  sidebar -->
    <?php 
    $taxonomy_name=$wp_query->queried_object->taxonomy;
    if ( is_active_sidebar( $taxonomy_name.'_listing_sidebar') ) : ?>
    	<div id="sidebar-primary" class="sidebar">
    		<?php dynamic_sidebar($taxonomy_name.'_listing_sidebar'); ?>
    	</div>
    <?php 
    elseif ( is_active_sidebar( 'primary-sidebar') ) : ?>
    	<div id="sidebar-primary" class="sidebar">
    		<?php dynamic_sidebar('primary-sidebar'); ?>
    	</div>
    <?php endif; ?>
    <!--end taxonomy sidebar -->
    <?php get_footer(); ?>
    
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.