Exemplo n.º 1
0
    function widget($args, $instance)
    {
        global $post, $wpdb;
        $post_in_block = $instance['post_in_block_latest_apps'];
        if (is_single()) {
            $info_cat_post = info_category_post($post->ID);
            $lasted_posts = new WP_Query(array('post_type' => 'apps', 'posts_per_page' => $post_in_block, 'order' => 'DSC', 'cat' => $info_cat_post['term_id']));
            ?>

		<div class="sidebar-widget">

  				<h3 class="widget-head">latest <?php 
            echo $info_cat_post['parent_cat_name'];
            ?>
 </h3>

  			 <ul class = "sb-tabs-wrap" >
	  			<?php 
            while ($lasted_posts->have_posts()) {
                $lasted_posts->the_post();
                ?>
	  			  
	  			   <li>
	  			   		 
	  			   		<div class="sb-post-thumbnail">
	  			   		  <a href="<?php 
                the_permalink();
                ?>
"  title="<?php 
                the_title();
                ?>
">
	  			   		  	<?php 
                the_post_thumbnail(array(80, 80), array('alt' => get_the_title()));
                ?>
	  			   		  </a> 
						</div>
						<div class="sb-post-list-title">
							<h4><a href="<?php 
                the_permalink();
                ?>
"  title="<?php 
                the_title();
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
						
							<div class="sb-post-meta">
								<p><?php 
                the_modified_time('F jS, Y');
                ?>
</p>
							</div>
							<div class="sb-post-meta">
								<a href="<?php 
                the_permalink();
                ?>
"  title="<?php 
                the_title();
                ?>
">Download APK</a>
							</div>
						</div>
						 
	  			   </li>
  				 
 				<?php 
            }
            wp_reset_query();
            ?>
 			  </ul>
  			</div>
  
	<?php 
        }
        ?>


  <?php 
    }
Exemplo n.º 2
0
    function widget($args, $instance)
    {
        global $post, $wpdb;
        $post_in_block = $instance['post_in_block_hot_apps'];
        if (is_category()) {
            $cat_ID = get_query_var('cat');
            $title = get_query_var('category_name');
            $q_obj = get_queried_object();
            $query = "SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE parent={$cat_ID}";
            $res = $wpdb->get_results($query, 'ARRAY_N');
            if ($res) {
                for ($i = 0; $i < count($res); $i++) {
                    $list_ids[] = $res[$i][0];
                }
                $list_ids = implode(',', $list_ids);
            }
            if ($list_ids) {
                $query = "SELECT p.ID, p.post_title, p.guid FROM wp_posts p \n\t\t\t\t\t\t\t INNER JOIN wp_data_post_views dpw ON \n\t\t\t\t\t\t\t \tp.ID=dpw.post_id \n\t\t\t\t\t\t\t INNER JOIN wp_term_relationships tr ON \n\t\t\t\t\t\t\t \tp.ID=tr.object_id \n\t\t\t\t\t\t\t WHERE tr.term_taxonomy_id IN (" . $list_ids . ") ORDER BY dpw.views DESC LIMIT " . $post_in_block;
            } else {
                $query = "SELECT p.ID, p.post_title, p.guid FROM wp_posts p \n\t\t\t\t\t\t\tINNER JOIN wp_data_post_views dpw ON \n\t\t\t\t\t\t\t \tp.ID=dpw.post_id\n\t\t\t\t\t\t\tINNER JOIN wp_term_relationships tr ON\n\t\t\t\t\t\t\t\t\tp.ID=tr.object_id\n\t\t\t\t\t\t\tWHERE tr.term_taxonomy_id=" . $q_obj->term_taxonomy_id . " ORDER BY dpw.views DESC LIMIT " . $post_in_block;
            }
        }
        if (is_page()) {
            $cat = get_the_category();
            $title = $cat[0]->cat_name;
            if ($cat) {
                $query = "SELECT p.ID, p.post_title, p.guid FROM wp_posts p \n\t\t\t\t\t\t\tINNER JOIN wp_data_post_views dpw ON \n\t\t\t\t\t\t\t \tp.ID=dpw.post_id\n\t\t\t\t\t\t\tINNER JOIN wp_term_relationships tr ON\n\t\t\t\t\t\t\t\t\tp.ID=tr.object_id\n\t\t\t\t\t\t\tWHERE tr.term_taxonomy_id=" . $cat[0]->term_taxonomy_id . " ORDER BY dpw.views DESC LIMIT " . $post_in_block;
            } else {
                $title = 'Apps & Games';
                $cat = get_categories('parent=0');
                if ($cat) {
                    foreach ($cat as $term_id) {
                        $list_ids[] = $term_id->term_taxonomy_id;
                    }
                }
                $list_ids = implode(',', $list_ids);
                $query = "SELECT p.ID, p.post_title, p.guid FROM wp_posts p \n\t\t\t\t\t\t\t INNER JOIN wp_data_post_views dpw ON \n\t\t\t\t\t\t\t \tp.ID=dpw.post_id \n\t\t\t\t\t\t\t INNER JOIN wp_term_relationships tr ON \n\t\t\t\t\t\t\t \tp.ID=tr.object_id \n\t\t\t\t\t\t\t WHERE tr.term_taxonomy_id IN (" . $list_ids . ") ORDER BY dpw.views DESC LIMIT " . $post_in_block;
            }
        }
        if (is_front_page()) {
            $title = 'Apps & Games';
            $query = "SELECT term_id FROM wp_term_taxonomy WHERE parent != 0";
            $res = $wpdb->get_results($query, 'ARRAY_N');
            if ($res) {
                for ($i = 0; $i < count($res); $i++) {
                    $list_ids[] = $res[$i][0];
                }
                $list_ids = implode(',', $list_ids);
            }
            $query = "SELECT p.ID, p.post_title, p.guid FROM wp_posts p \n\t\t\t\t\t\t\t INNER JOIN wp_data_post_views dpw ON \n\t\t\t\t\t\t\t \tp.ID=dpw.post_id \n\t\t\t\t\t\t\t INNER JOIN wp_term_relationships tr ON \n\t\t\t\t\t\t\t \tp.ID=tr.object_id \n\t\t\t\t\t\t\t WHERE tr.term_taxonomy_id IN (" . $list_ids . ") GROUP BY p.ID ORDER BY dpw.views DESC LIMIT " . $post_in_block;
        }
        if (is_single()) {
            $info_cat_post = info_category_post($post->ID);
            $query = "SELECT p.ID, p.post_title, p.guid FROM wp_posts p \n\t\t\t\t\t\tINNER JOIN wp_data_post_views dpw ON \n\t\t\t\t\t\t\tp.ID=dpw.post_id\n\t\t\t\t\t\tINNER JOIN wp_term_relationships tr ON\n\t\t\t\t\t\t\tp.ID=tr.object_id\n\t\t\t\t\t\tWHERE tr.term_taxonomy_id=" . $info_cat_post['current_tax_id'] . " ORDER BY dpw.views DESC LIMIT " . $post_in_block;
            $title = 'Hot ' . $info_cat_post['cat_name'] . ' ' . $info_cat_post['parent_cat_name'];
        }
        $res = $wpdb->get_results($query);
        ?>
 
 		  <div class="sidebar-widget">
  				<h3 class="widget-head"> <?php 
        echo 'Hot ' . $title;
        ?>
</h3>
  				<div class=" popular-rec">
	  			 <ul class = "top-list" >
 					<?php 
        foreach ($res as $post) {
            setup_postdata($post);
            ?>
		  				<li class="wpp-list">
		  			   		<a href="<?php 
            the_permalink();
            ?>
"> <?php 
            the_title();
            ?>
</a> 
						</li>
	  				<?php 
        }
        ?>
	 			  </ul>
	 			 </div>
  			</div>
  			 
 <div class=" clearfix" > </div>
  
 
  <?php 
    }
Exemplo n.º 3
0
<?php

get_header();
set_post_views(get_the_ID());
$info_cat_post = info_category_post($post->ID);
if ($info_cat_post['parent_cat_name'] == 'Apps') {
    ?>
	
	<?php 
    if (has_nav_menu('sub_cat_menu_a')) {
        ?>
   
		<div id="catnav" class="secondary">	
			<?php 
        wp_nav_menu(array('theme_location' => 'sub_cat_menu_a', 'container' => '', 'menu_id' => 'sub_catmenu', 'menu_class' => 'catnav  container clearfix', 'fallback_cb' => 'false', 'depth' => 3));
        ?>
		</div> 
	  
	<?php 
    }
    ?>
 

<?php 
} elseif ($info_cat_post['parent_cat_name'] == 'Games') {
    ?>

	<?php 
    if (has_nav_menu('sub_cat_menu_g')) {
        ?>