Tag Info

New answers tagged

1

Your use of queries is completely wrong, and as stated before, query_posts should never be used. The method you are using to retrieve you category ID's are also a waste of resources. It would save much more if you knew the ID's. I would also look at get_categories to retrieve my category details and passing that to my custom query. METHOD 1 If these ...


0

This means the variable $path is an array(). You have to pull only the path (a string value) from it. You can do print_r($path) to see what values it contains. e.g. if it shows something like this Array([0] => path/to/file) , you will need to use urlencode($path[0]) instead of urlencode($path).


2

First of all, never use query_posts. Rather use WP_Query to construct your custom query which is the prefered way You are also using the category_name parameter wrong. If you look at the WP_Query documentation, it states category_name (string) - use category slug (NOT name). Go and have a look at the examples given in the docomentation under the ...


2

The third parameter for add_filter is the priority in which the filter is executed, the forth is the number of parameters the function in the second parameter uses. The wpcodex_filter_main_search_post_limits function has an if that checks uses a couple of wordpress function to establish where in your page you are executing the code, in this case it's ...


0

I wanted to add my case to this list since it took me ages to debug, what happens is that i changed the number of posts an archive page displayed by hooking into the pre_get_post hook: add_filter('pre_get_posts', 'number_of_posts_on_archive'); function number_of_posts_on_archive($query) { if(is_post_type_archive(array('post_type1', 'post_type2'))) { ...


0

Single pages are designed to display a single post, and not an index of posts as an archive page would. I'm not really sure what are you trying to achieve here as well. It is always a bad idea to try and use a specific template for anything else than what it was intended for. The main query are quite specific to a specific template, in this case, the main ...


0

Not tested but you can try this: $args = array( 'posts_per_page' => 4, 'post_type' => 'post', 'meta_key' => 'meta-select', 'order' => 'ASC', 'orderby' => 'meta_value_num', 'meta_query' => array( array( 'key' => 'meta-select', 'value' => ...



Top 50 recent answers are included