WordPress.org

Ready to get started?Download WordPress

Forums

issue with category pages (3 posts)

  1. Versipellis
    Member
    Posted 3 years ago #

    The site I'm working on has a page for each category using the following code:

    <?php
    if (is_page() ) {
    $category = get_post_meta($posts[0]->ID, 'misc', true);
    }
    if ($category) {
      $cat = get_cat_ID($category);
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      $post_per_page = 4; // -1 shows all posts
      $do_not_show_stickies = 1; // 0 to show stickies
      $args=array(
        'category__in' => array($cat),
        'orderby' => 'date',
        'order' => 'DESC',
        'paged' => $paged,
        'posts_per_page' => $post_per_page,
        'caller_get_posts' => $do_not_show_stickies
      );
      $temp = $wp_query;  // assign orginal query to temp variable for later use
      $wp_query = null;
      $wp_query = new WP_Query($args);
      if( have_posts() ) :
            while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <div class="new-wrapper">
    <?php the_time('F j, Y'); ?>
    
         <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    
        <div class="storycontent">
            <?php the_content(__('(more...)')); ?>
        </div>
    
    </div>
        <?php endwhile; ?>
        <div class="navigation">
          <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
          <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
        </div>
      <?php else : ?>
    
            <h2 class="center">Not Found</h2>
            <p class="center">Sorry, but you are looking for something that isn't here.</p>
            <?php get_search_form(); ?>
            </div>
    
        <?php endif; 
    
        $wp_query = $temp;  //reset back to original query
    
    }  // if ($category)
    ?>

    However the 'more' part doesnt work and the writing after the 'more' just spills out onto the page.

    However on my home page where I use the standard coding for WP the 'more' works fine. The posts are displayed in a grid with a limited space per post so the 'more' bit is quite important!

    But as far as I can see the 'more' coding is identical on both parts using:

    <div class="storycontent">
            <?php the_content(__('(more...)')); ?>
        </div>

    Can someone please help me to rectify this issue? I've been racking my brain for days and I cant get it to work.

    Thanks!

    Versipellis

  2. Alexandru Vornicescu
    Member
    Posted 3 years ago #

  3. Versipellis
    Member
    Posted 3 years ago #

    Thanks very much :)

    Sorted now :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.