• Resolved der_ele

    (@der_ele)


    Hello!
    I have the following problem:
    The “read more..” is not shown on my custom page, but on the index.php.
    Here my code:

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     * Template Name: Aktuelles
    */
    global $more;
    
    $cat= 3;
    $posts = get_posts ("cat=$cat&showposts=5");
      if ($posts) {
        foreach ($posts as $post):
    	$more = false;
    	setup_postdata($post);
           ?>
    	<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    	<p class="storycontent"><?php the_content('Read more...'); ?></p>
        <?php
    	endforeach;
        $more = true;
      }
    
    ?>

    Thanks in advance der_ele

Viewing 5 replies - 1 through 5 (of 5 total)
  • <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     * Template Name: Aktuelles
    */
    
    $cat= 1;
    $posts = get_posts ("cat=$cat&showposts=5");
      if ($posts) {
        foreach ($posts as $post):
    	$more = false;
    	setup_postdata($post);
           global $more;
           $more = false;?>
    	<h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    	<p class="storycontent"><?php the_content('Read more...'); ?></p>
        <?php
    	endforeach;
        $more = true;
      }
    
    ?>
    Thread Starter der_ele

    (@der_ele)

    Thanks working perfect!

    pironic

    (@pironic)

    prefect this worked for me too… its just a problem with the $more variable eh?

    I had this:
    foreach ($postslist as $post) :
    setup_postdata($post);

    and added:
    global $more;
    $more = false;
    immediately following to fix my code. Thanks for the help MichaelH!

    pironic

    (@pironic)

    –deleted duplicate post–

    That is one weird hack. Worked, but seems like a bug, no?

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

The topic ‘the_content with setup_postdata’ is closed to new replies.