Post formats template

Post formats are used to customize posts according to their “meta” content, but they are always posts and as posts they will be listed on archive and category pages. What is parent template file that is used when there is no specified template file and what is specified template file that covers all post formats … Read more

How to let custom post type posts show in standard post archive (like in homepage)?

Hooking the following function with the pre_get_posts filter will add one or more CPTs to the regular archive pages: function wpse94041_cpts_in_archives( $query ) { if( is_category() || is_tag() ) { // more conditional tags possible, if applicable $query->set( ‘post_type’, array( ‘post’, ‘tutorial’ // add as many CPTs to this array as you like )); } … Read more

Output yearly archive within a page

You can just use a normal query to grab all posts (which are, by default, sorted date descending), and break them up as you loop over them: <?php $posts = new WP_Query( array( ‘posts_per_page’ => -1, ‘post_type’ => ‘press-releases’ ) ); if ( $posts->have_posts() ) : ?> <ul class=”accordion”><?php while ( $posts->have_posts() ) : $posts->the_post(); … Read more

How to show a tag archive of one post type only

I’ve worked out a solution to this. I hope this can help someone else. First add the following two functions to your functions.php (or plugin) file: function get_terms_by_post_type( $taxonomies, $post_types ) { global $wpdb; $query = $wpdb->prepare( “SELECT t.*, COUNT(*) from $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN … Read more

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