Showing post thumbnail (attachment) on the archive.php category listing

You could use the WordPress function get_children. Although I don’t think it makes a difference, performance-wise. <?php while (have_posts()) : the_post(); ?> <?php $attachment = array_values( get_children( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘numberposts’ => 1 ) ) ); ?> <div class=”searchItem” style=”clear:both;”> <h3 id=”post-<?php the_ID(); ?>”> <?php … Read more

How can i display the posts per week in a particular month?

You’ll need to add a condition to the posts_where filter in wordpress. I have an example here for only pulling posts that are from the current post’s date and earlier: Add this to functions.php // filter wp_query when $dated_before is set function dg_dated_before($where) { global $wp_query, $wpdb, $dated_before; if (isset($dated_before)): $where = $where . ” … Read more

Display direct children of the current custom taxonomy in taxonomy.php template

See the Codex. The wp_list_categories allows you to set a child_of and a depth (in this case 1, we only want to go one level down). See the link to the Codex about styling it; there’s a whole host of options. <?php $term = get_queried_object(); wp_list_categories(array( ‘taxonomy’=>$term->taxonomy, ‘child_of’=>(int) $term->term_id, ‘hide_empty’=>0, ‘depth’=>1, )); ?> I’ve only … Read more

WP_Query() returns null when results exist!

The is_single function (used in your excerpt.php file) returns true only when the main query contains one single post. Since you’re calling get_template_part from an archives page, your query contains more than one post, so is_single returns false and your excerpt.php file bails. Remove the check for is_single and you should be good to go. … Read more

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