Difference between an archive and a page listing posts

Archive Page An archive page is part of the WordPress Template Hierarchy, and is the template file WordPress uses to display the archive index list for a given post type. The custom post type archive template hierarchy is as follows: archive-{posttype}.php archive.php index.php WordPress uses the query parameters to output this page, and posts are … Read more

How to get category and archive title?

For category use single_cat_title function: http://codex.wordpress.org/Function_Reference/single_cat_title For tag use single_tag_title function: http://codex.wordpress.org/Function_Reference/single_tag_title For date use get_the_date function: http://codex.wordpress.org/Function_Reference/get_the_date For example if you open twentyten theme you will see following: category.php: <h1 class=”page-title”><?php printf( __( ‘Category Archives: %s’, ‘twentyten’ ), ‘<span>’ . single_cat_title( ”, false ) . ‘</span>’ ); ?></h1> date.php: <h1 class=”page-title”> <?php if ( … Read more

Only get_posts of certain post formats

You can’t actually pass a taxonomy-related argument to get_posts(). (Edit: actually, yes you can. The Codex is just somewhat unclear. Looking at source, get_posts() is, at its heart, just a wrapper for WP_Query().) You can pass meta keys/values, and post types, but not taxonomies such as post format. So for this line: $myposts = get_posts(‘numberposts=-1&orderby=post_date&order=DESC’); … Read more

Increase number of posts in archive page

You can use pre_get_posts in your functions file to alter the query function wpsites_query( $query ) { if ( $query->is_archive() && $query->is_main_query() && !is_admin() ) { $query->set( ‘posts_per_page’, 100 ); } } add_action( ‘pre_get_posts’, ‘wpsites_query’ );

Default archive URL wordpress

This may be an old question, but all the answers here are incorrect. If the front page is set to a static page, and another page is set to the blog page, this will dynamically fetch and echo the URL for the blog archive page (i.e. blog index page)… <?php echo get_permalink( get_option( ‘page_for_posts’ ) … Read more