the_title() does not show but the_execerpt()
-
Hello,
on a page (not homepage) I have this code:$args = array( 'posts_per_page' => 3 ); $lastposts = get_posts( $args ); foreach ( $lastposts as $poster ) : echo get_the_ID(); setup_postdata( $poster ); ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php the_date(); the_excerpt(); ?> <?php endforeach; wp_reset_postdata();
the_execerpt() shows correctly 3 different values (from the posts), but all other functions show the values from the page where I placed the code.
The page ID is in my case 678, so the_ID() shows 3 times 678,
the_permalink() links to the page 678 and the_title() shows 3 times the title of the page.Any idea ?
Best regards, Uwe
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘the_title() does not show but the_execerpt()’ is closed to new replies.