Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 134430

randis83 on "How do I tell Wordpress a page is an archive?"

$
0
0

The use case is that I want to list the most recent posts on a page. Each post containing only the summary and title and a link to the full post.

I have created a template called Latest Posts and it loads ok. However I want get_content() to somehow understand that this template is an archive template and therefore only display the excerpt and not the full post.

I use the following "content" template for all other listings and would like to reuse it when listing my latest posts, but since it isn't either a search or an archive the first selection is skipped, and the_content() will show the whole post.

<?php if ( is_search() ) : // Only display Excerpts for Search ?>
<div class="entry-summary">
    <?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
    <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'bbl' ) ); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'bbl' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php endif; ?>

Any ideas? I've been looking around for ideas, and I've seen a lot of different ways to make archives, but I haven't been able to put it all together to fit my use case.


Viewing all articles
Browse latest Browse all 134430

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>