SQL query to select posts from multiple categories

I would use the built in API like Rarst mentioned. You could do something like this: $just_seven = new WP_Query( array( ‘category__in’ => array( 7 ), ‘category__not_in’ => array( 10 ) ) ); You would then have those items in $just_seven->posts. However, if you MUST use a direct SQL statement, I’d suggest using INNER JOIN … Read more

WordPress 3.2 query_posts and pagination, permalinks issue

From the WP Codex for WP_Query: Show Posts from Current Page Display posts from current page: $query = new WP_Query( ‘paged=’ . get_query_var( ‘page’ ) ); Pagination Note: You should set get_query_var( ‘page’ ); if you want your query to work with pagination. Since WordPress 3.0.2, you do get_query_var( ‘page’ ) instead of get_query_var( ‘paged’ … Read more

Using ajax with paging and a custom sub-query

Two options- load a page fragment using jQuery’s load method (see Loading Page Fragments), or create your own ajax function to load posts and return it in whatever markup you wish: add_action(‘wp_ajax_my_ajax_get_posts’, ‘my_ajax_callback’); add_action(‘wp_ajax_nopriv_my_ajax_get_posts’, ‘my_ajax_callback’); function my_ajax_callback() { $args = $_POST[‘myargs’]; $collected_child_posts = new WP_Query($args); echo ‘some stuff’; die(); } pass the admin-ajax url to … Read more

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