“pre_get_posts” firing on every query

Basically what you are looking for is the global $wp_the_query variable which is set to the value of the main query. It may not be a perfect fit for 100% of cases but will probably work fine in 99% of cases: add_action( ‘pre_get_posts’, ‘custom_post_count’ ); function custom_post_count( $query ){ global $wp_the_query; if ( $wp_the_query === … Read more

Display content from a specific category

The argument isn’t category, it is cat. Your query fails because you are using an argument that doesn’t exist. $args = array( ‘post_type’ => ‘post’ , ‘orderby’ => ‘date’ , ‘order’ => ‘DESC’ , ‘posts_per_page’ => 6, ‘cat’ => ‘3’, ‘paged’ => get_query_var(‘paged’), ‘post_parent’ => $parent ); $q = new WP_Query($args); if ( $q->have_posts() ) … Read more

is_home, and is_front_page conditional problem

Let’s see if I can confuse myself. If either of your two OR conditions is true the code executes. is_home and is_front_page can return true for different pages, negated in your case. If you have a static from page, which it sounds like you do, then is_home is the blog index page. Note: WordPress 2.1 … Read more

Custom Loop and Infinite Scroll

I used ‘init’ in the add_action in my own implementation of infinite scroll, try that. add_action( ‘init’, ‘vg_infinite_scroll_init’ ); As to your question about rendering a custom query you would do the following. -Set the render to your function name ‘render’ => ‘your_render_function, -Add your function to call a specified loop template function your_render_function(){ get_template_part( … Read more

AJAX handler throws 400 (Bad request) – why?

in your html add `<input name=”action” type=”hidden” value=”test_function”/>` here “value” is your “action_name”. Your ajax call is incorect. Data should be url: “your php action script” data: $(html data).serialize(), About ajax first try to create ajax on your computer without wordpress. When you understand how ajax work try on WordPress.

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