Hiding all posts/products/pages from a site based on a custom taxonomy/domain name

From the Codex for pre_get_posts: pre_get_posts cannot be used to alter the query for Page requests (page templates) because ‘is_page’, ‘is_singular’, ‘pagename’ and other properties (depending if pretty permalinks are used) are already set by the parse_query() method. See: Query Overview. The recommended way to alter the main query for page requests is to use … Read more

Custom query on custom table fails

On volume pass single quote in parameter. Now your query is SELECT * FROM cp WHERE year=”1911″ AND quarter=”4″ AND volume=”2a” AND page <= ‘1475’ ORDER BY page DESC LIMIT 1 Try this code

Using orderby with 2 meta keys

One of the options would be to sort at a database level by a dynamically calculated column. This is too complex for me. Having your task on production I would probably create a third meta key: ‘division’ derivated from the two and update its value on every post save. Then I would sort by this … Read more

Add pagination to table generated by wp_query

As already pointed out in comments gb_bypass_filter is not a valid parameter for WP_Query. If you want to suppress to effect of filters on your query, add ‘suppress_filters’ => true to your query arguments previous_posts_link() does not accept two arguments, only one. Unlike next_posts_link(), it does not have the second $max_pages parameter. So you can … Read more

Pagination not working with WP_QUERY

You are most probably not doing this on a static front page, so your paged parameter is using wrong values. Static front pages uses get_query_var( ‘page’ ) to calculate pagination, all other pages uses get_query_var( ‘paged’ ) You need to also set the $max_pages parameter in next_posts_link. Without that, your links won`t display <p class=”older”><?php … Read more

Show parent’s child and also child’s, child on a page?

Will get_pages() work for you? http://codex.wordpress.org/Function_Reference/get_pages If I’m understanding your question correctly, you would want something like this: $children_of_page = get_pages(array( ‘child_of’ => $post->ID, ‘parent’ => $post->ID //defining both parent and child forces the list to only include direct children. )); $children_of_first_child = get_pages(array( ‘child_of’ => $children_of_page[0][ID], ‘parent’ => $children_of_page[0][ID] )); If you wanted to … Read more

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