How can I create a master archive?

to accomplish that, this what I did for my blog: (1) create a page template, say “masterarcive” (2) add the code in that page. (3) this code also include pagination Here is my entire page template with the complete code I use in it: <?php /** * @package WordPress * @subpackage Default_Theme */ /* Template … Read more

Display an archives name

This is probably what you need: <?php if (is_category()) { // Show only on Category archive pages ?> <h1><?php echo single_cat_title(‘News: ‘); ?></h1> <?php } elseif (is_tag()) { // Show only on Tag archive pages ?> <h1><?php echo single_tag_title(‘News: ‘); ?></h1> <?php } ?> OR like this (as @StephenHarris pointed out): <h1><?php if ( is_category() … Read more

Show all 12 months regardless they have posts

I believe this is correct: $year = 2013; $month = 0; $qry = new WP_Query( array( ‘post_type’=>’post’, ‘posts_per_page’=>-1, ‘orderby’=>’date’, ‘order’=>’ASC’, ‘ignore_sticky_posts’ => true, ‘year’ => $year, ) ); while ($month < 12) { $month++; echo date(‘M’,strtotime(‘2000-‘.str_pad($month, 2, ‘0’, STR_PAD_LEFT).’-01 00:00:01′)).'<br>’; if ($qry->have_posts()) { while ($qry->have_posts()) { if (date(‘n’,strtotime($qry->post->post_date)) == $month) { echo ” — “; … Read more

Remove posts from two categories in Archive Page

try this… Not Tested add_action(“pre_get_posts”,”my_category_remove”); function my_category_remove($query) { if(is_archive()) { $query->set(‘category__not_in’, array(/*the categories (ID’s) you wish not to show, comma separated*/)); } return $query; } Reference

Custom archive pages without “the loop”

You should filter the default $query via callback hooked into pre_get_posts: function wpse108983_filter_pre_get_posts( $query ) { // Make sure we’re targeting // the main loop query, and // only in the archive context if ( $query->is_main_query() && is_archive() ) { // Add your query modifications here // For example, to sort by date: $query->set( ‘orderby’, … Read more

Show Daily Archives after specific dates

do so like this add_filter( ‘getarchives_where’, ‘my_archives_filter_function’, 10, 2 ); create function function my_archives_filter_function($text, $r) { return “WHERE post_type=”post” AND post_status=”publish” AND post_date >= ‘2013-08-01′”; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)