Display CPT index page as front/home page

Rename portfolio-archive.php to front-page.php and change the post type for that page with a filter on pre_get_posts: add_filter( ‘pre_get_posts’, ‘wpse_99860_portfolio_on_front’ ); function wpse_99860_portfolio_on_front( $query ) { // not the main loop if ( ! $query->is_main_query() ) return $query; // not the front page if ( ! $query->is_front_page() ) return $query; $query->set( ‘post_type’, array ( ‘portfolio’ … 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

Display in category ( taxonomy) a number of post that I want

If I understand your question right you seem to have the code that seems close to what you want, but doesn’t function correctly. What I have trouble following is that your description talks about taxonomy archives, but your code seems to be about custom post type archives. I would suggest to use more appropriate query … Read more

how to show only particular category post in archive widgets

add_filter( ‘getarchives_join’ , ‘getarchives_join_filter’); function getarchives_join_filter( $join ) { global $wpdb; return $join . ” INNER JOIN {$wpdb->term_relationships} tr ON ($wpdb->posts.ID = tr.object_id) INNER JOIN {$wpdb->term_taxonomy} tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)”; } add_filter( ‘getarchives_where’ , ‘getarchives_where_filter’); function getarchives_where_filter( $where ) { global $wpdb; return $where . ” AND tt.taxonomy = ‘category’ AND tt.term_id=’blog category id’ … 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

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