Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi and thanks for your support. I tried a different approach and it works well (http://wordpress.planetfreu.de/category/allgemein/). If anyone is interested in putting different appearances to excerpt on the category page – this works:

    <?php if (have_posts()) : ?>
    <?php $count = 0; ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $count++; ?>
      <?php if ($count <= 3) : ?>
      				<div <?php post_class(); ?>>
                <div class="entry-content first">
                  <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'mega' ); ?></a>
                  <?php genesis_post_title(); ?>
                  <?php wpe_excerpt('wpe_excerptlenght_teaser', 'wpe_excerptmore'); ?>
                </div><!-- end .entry-content -->
              </div>
       <?php elseif ($count == 4) : ?>
       <div id="featured-bottom">
       <h4 class="widgettitle">weitere News</h4>
       <?php elseif ($count <= 7) : ?>
       				<div <?php post_class(); ?>>
                <div class="entry-content second">
                  <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'large' ); ?></a>
                  <?php genesis_post_title(); ?>
                  <?php wpe_excerpt('wpe_excerptlenght_short', 'wpe_excerptmore'); ?>
                </div><!-- end .entry-content -->
              </div>
       <?php elseif ($count == 8) : ?>
       </div><div class="clear"></div>
       <?php else : ?>
              <div <?php post_class(); ?>>
                <div class="entry-content third">
                  <?php genesis_post_title(); ?>
                  <?php wpe_excerpt('wpe_excerptlenght_mini', 'wpe_excerplink'); ?>
                </div><!-- end .entry-content -->
              </div>
      <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>
    <?php if(is_single()) { // single-view navigation ?>
    	<?php $posts = query_posts($query_string); if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<?php previous_post_link(); ?> | <?php next_post_link(); ?>
    	<?php endwhile; endif; ?>
    <?php } else { // archive view navigation ?>
    		<?php posts_nav_link(); ?>
    <?php } ?>

    Hi alchymyth, thanks so far. There shouldn’t be anything like featured. I just want to separate two kinds of posts from each other. Here’s the link:

    http://wordpress.planetfreu.de/category/allgemein/

    and here the code:

    1. This switches between Category and Subcategory, works:

    <?php get_header(); ?>
    <?php genesis_before_content_sidebar_wrap(); ?>
    <div id="content-sidebar-wrap">
    
    <?php genesis_before_loop(); ?>
    
    <?php genesis_before_content(); ?>
      <div id="content" class="hfeed">
        <h1 class="cat-title">News im Bereich - <?php single_cat_title(); ?></h1>
        <?php if (is_category()) {
        $this_category = get_category($cat);
        if (get_category_children($this_category->cat_ID) != "") {
        // This is the Template for Category level 1
        include(CHILD_DIR.'/maincategory.php');
        }
        else	{
        // This is the Template for Category level 2
        include(CHILD_DIR.'/subcategory.php');
        }
    
        } ?>
      </div><!-- end #content -->
    <?php include(CHILD_DIR.'/sidebar-category.php'); ?>
    
    </div><!-- end #content-sidebar-wrap -->
    <?php genesis_after_content_sidebar_wrap(); ?>
    
    <?php get_footer(); ?>

    2. This is the subcategory. There should be 2 – 3 Items, each with 3 or 4 Post excerpts. Right now it doesn’t work because some content is duplicate at the second page.

    <?php if (have_posts()) : ?>
    <?php rewind_posts(); ?>
    <?php
    wp_reset_query();
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat='.$cat.'&orderby=date&order=DESC&posts_per_page=3&paged='.$paged);
    while (have_posts()) : the_post(); update_post_caches($posts);
    $do_not_duplicate[] = $post->ID;
    ?>
    <div <?php post_class(); ?>>
      <div class="entry-content first">
        <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'mega' ); ?></a>
        <?php genesis_post_title(); ?>
        <?php wpe_excerpt('wpe_excerptlenght_teaser', 'wpe_excerptmore'); ?>
      </div><!-- end .entry-content -->
    </div>
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?><!-- ... end of First Teasers -->
    <div id="bottomposts">
     <?php if (have_posts()) : ?>
    <?php rewind_posts(); ?>
    <?php 
    
    query_posts('cat='.$cat.'&orderby=date&order=DESC&posts_per_page=5');
    
    while (have_posts()) : the_post(); update_post_caches($posts);
    if ( !in_array( $post->ID, $do_not_duplicate ) ):
    ?>
    <div class="postovi">
     <h2><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h2>
    <?php wpe_excerpt('wpe_excerptlenght_short', 'wpe_excerptmore'); ?><p></p>
    <a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>">Read more...</a>
    </div>
    <?php endif; ?>
    <?php endwhile; ?>
    <?php else : ?>
    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.</p>
    <?php endif; ?>
    </div>
    
    <div class="pagination">
      <div class="previous"><?php previous_posts_link('Previous Entries') ?></div>
      <div class="next"><?php next_posts_link('Next Entries') ?></div>
    </div>

    Thanks a lot in advance …

    This was really helpfull for me. But in my case I am trying to renew even the first three posts. Is there any way to do that?

    Thread Starter triplebull

    (@triplebull)

    Thanks again. Now I found this solution. Perhaps there is a smarter way but this is much easier than to define every parent id.

    <?php if (is_category()) {
        $this_category = get_category($cat);
        if (get_category_children($this_category->cat_ID) != "") {
    			// This is the Template for Category level 1
          include(CHILD_DIR.'/maincategory.php');
        }
    		else	{
    			// This is the Template for Category level 2
    			include(CHILD_DIR.'/subcategory.php');
    		}
    
      } ?>
    Thread Starter triplebull

    (@triplebull)

    Thank you! But am i right that in this case I have to define every single Category by a category-ID.php page?
    I just want that parent categories use another template than child categories e.g:

    Category a (template-a.php)
    -Subcategory 1 (template-b.php)
    -Subcategory 2 (template-b.php)
    Category b (template-a.php)

Viewing 5 replies - 1 through 5 (of 5 total)