How to end this loop properly?

Let’s throw everything, but loop out: if ($my_query->have_posts()) { // open container around all posts while ($my_query->have_posts()) : $my_query->the_post(); // output for every post endwhile; // close containers around all posts } As you see: output of posts goes inside while loop as usual; opening larger containers is between checking if we have posts and … Read more

Loop custom post type by taxonomy (Category)

Before the loop starts use query_posts. Available parameters are here. Something like this: global $wp_query; query_posts( array( ‘post_type’ => ‘mycustomname’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘mytaxonomyname’, ‘field’ => ‘slug’, ‘terms’ => array( ‘myterm1slug’, ‘myterm2slug’ ) ) ) ) );

Display content from “About Us” page on the Home Page

If you’re using WP_Query, then assign that page a custom meta key ‘home_content’ with a value as 1. Then use WP_Query’s custom field parameters to loop over it. If you can restrict the title as ‘About’ everywhere, use get_page_by_title, and if you can restrict the slug as ‘about’, use get_page_by_path. These methods will work dynamically.

The pagination doesn’t work

If this is a new WordPress install, it is likely that you don’t actually have enough posts to require pagination, and thus the pagination links aren’t appearing. Quick test: ensure you have at least two posts, then go to Dashboard -> Settings -> Reading, and change the “Posts Per Page” setting to 1. Do you … Read more

query_posts and sub pages?

I’m pretty sure you can use get_pages (http://codex.wordpress.org/Function_Reference/get_pages) function to solve this. It has child_of parameter which does exactly what you wanted. The only problem is that it returns posts and not set $wp_query, so you can’t use it as loop, but you can always call setup_postdata and then use template tags as in normal … Read more

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