Wordpress only post 1 post from each category -


i have site: http://n0rd.no/testing/ try make each podcast 1 post on front-page , not 1 pr post in category.

i found how 1 post each category in wordpress on site, cant figure out how make work code.

can please me?

<?php /* template name: category view */ ?> <?php get_header(); ?>  <?php     // determine column/image size front page     $cols = '3';     $cols = get_option('woo_cols');     $r1 = 3; $r2 = 2;     if (get_option('woo_ratio1')) $r1 = get_option('woo_ratio1');     if (get_option('woo_ratio2')) $r2 = get_option('woo_ratio2');     if ( $cols == "1") {         $class = "one"; $width = 940; $height = $width / $r1 * $r2;     } elseif ( $cols == 2 ) {         $class = "two"; $width = 460;      } elseif ( $cols == 3 ) {         $class = "three"; $width = 300;      } elseif ( $cols == 4 ) {         $class = "four"; $width = 220;      } elseif ( $cols == 5 ) {         $class = "five"; $width = 172;      }     $height = $width / $r1 * $r2;        $height = round($height); ?>      <!-- content starts -->     <div class="content">      <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('cat=83'); ?>     <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); $count++; ?>          <!-- post starts -->         <div class="bg-photo-thumb <?php echo $class; ?>-col<?php if ($count == $cols) { echo ' last'; $count = 0; } ?>">         <div class="photo-thumb"><?php ciii_category_images(); ?><h2 class="cattitle"><?php  $category = get_the_category();  //print_r($category ); if($category[0]){ echo '<a href="'.get_category_link($category[0]->term_id ).'" class="catname">'.$category[0]->cat_name.'</a>'; } ?> </h2><br clear="all" /> <h3 class="catdisc"><?php echo $category[0]->category_description;  ?></h3>  <?php if (strpos($_server[http_referer], "twitter.com") == true) {     echo "hello twitter user!"; } ?>             <div class="fix"></div>          </div>         </div>         <!-- post ends -->      <?php endwhile; else: ?>         <p><?php _e('sorry, no posts matched criteria.', 'woothemes' ) ?></p>     <?php endif; ?>            <div class="fix"></div>         <div class="more_entries">             <?php if (function_exists('wp_pagenavi')) wp_pagenavi(); else { ?>             <div class="alignleft bg"><?php previous_posts_link(__('&laquo; newer entries ', 'woothemes' )) ?></div>             <div class="alignright bg"><?php next_posts_link(__(' older entries &raquo;', 'woothemes' )) ?></div>             <br class="fix" />             <?php } ?>          </div>               <div class="fix"></div>      </div><!-- content ends -->  <?php get_footer(); ?> 

update - work using code:

<?php /* template name: category view */ ?> <?php get_header(); ?>  <?php     // determine column/image size front page     $cols = '3';     $cols = get_option('woo_cols');     $r1 = 3; $r2 = 2;     if (get_option('woo_ratio1')) $r1 = get_option('woo_ratio1');     if (get_option('woo_ratio2')) $r2 = get_option('woo_ratio2');     if ( $cols == "1") {         $class = "one"; $width = 940; $height = $width / $r1 * $r2;     } elseif ( $cols == 2 ) {         $class = "two"; $width = 460;      } elseif ( $cols == 3 ) {         $class = "three"; $width = 300;      } elseif ( $cols == 4 ) {         $class = "four"; $width = 220;      } elseif ( $cols == 5 ) {         $class = "five"; $width = 172;      }     $height = $width / $r1 * $r2;        $height = round($height); ?>     <div class="content"> <?php  $news_cat_id = get_cat_id('news');  $news_cats   = get_categories("parent=$news_cat_id"); $news_query  = new wp_query();  foreach ($news_cats $news_cat): ?>  <?php $news_query->query('posts_per_page=1&cat=' . $news_cat->term_id); ?> <?php if ($news_query->have_posts()): $news_query->the_post(); ?>          <div class="post">         <div class="bg-photo-thumb <?php echo $class; ?>-col<?php if ($count == $cols) { echo ' last'; $count = 0; } ?>">         <div class="photo-thumb"><?php ciii_category_images(); ?><h2 class="cattitle"><?php  $category = get_the_category();  //print_r($category ); if($category[0]){ echo '<a href="'.get_category_link($category[0]->term_id ).'" class="catname">'.$category[0]->cat_name.'</a>'; } ?> </h2><br clear="all" /> <h3 class="catdisc"><?php echo $category[0]->category_description;  ?></h3>  <?php if (strpos($_server[http_referer], "twitter.com") == true) {     echo "hello twitter user!"; } ?>             <div class="fix"></div>          </div>         </div>             <!-- whatever else want can in normal loop -->         </div>    <?php endif; ?>  <?php endforeach; ?> </div> 

i used fix it:

<?php /* template name: category view */ ?> <?php get_header(); ?>  <?php     // determine column/image size front page     $cols = '3';     $cols = get_option('woo_cols');     $r1 = 3; $r2 = 2;     if (get_option('woo_ratio1')) $r1 = get_option('woo_ratio1');     if (get_option('woo_ratio2')) $r2 = get_option('woo_ratio2');     if ( $cols == "1") {         $class = "one"; $width = 940; $height = $width / $r1 * $r2;     } elseif ( $cols == 2 ) {         $class = "two"; $width = 460;      } elseif ( $cols == 3 ) {         $class = "three"; $width = 300;      } elseif ( $cols == 4 ) {         $class = "four"; $width = 220;      } elseif ( $cols == 5 ) {         $class = "five"; $width = 172;      }     $height = $width / $r1 * $r2;        $height = round($height); ?>     <div class="content"> <?php  $news_cat_id = get_cat_id('news');  $news_cats   = get_categories("parent=$news_cat_id"); $news_query  = new wp_query();  foreach ($news_cats $news_cat): ?>  <?php $news_query->query('posts_per_page=1&cat=' . $news_cat->term_id); ?> <?php if ($news_query->have_posts()): $news_query->the_post(); ?>          <div class="post">         <div class="bg-photo-thumb <?php echo $class; ?>-col<?php if ($count == $cols) { echo ' last'; $count = 0; } ?>">         <div class="photo-thumb"><?php ciii_category_images(); ?><h2 class="cattitle"><?php  $category = get_the_category();  //print_r($category ); if($category[0]){ echo '<a href="'.get_category_link($category[0]->term_id ).'" class="catname">'.$category[0]->cat_name.'</a>'; } ?> </h2><br clear="all" /> <h3 class="catdisc"><?php echo $category[0]->category_description;  ?></h3>  <?php if (strpos($_server[http_referer], "twitter.com") == true) {     echo "hello twitter user!"; } ?>             <div class="fix"></div>          </div>         </div>             <!-- whatever else want can in normal loop -->         </div>    <?php endif; ?>  <?php endforeach; ?> </div> 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -