Tag Info

New answers tagged

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' => ...


2

WordPress by default will only load 10 posts. That can be changed in the admin under Settings->Reading and then setting the amount beside "Blog pages show at most". You can override that number in your custom queries a couple of ways but I would first recommend against the use of query_posts() ( take a read at the link for the reasons why) in favour of ...


0

Try this: query_posts( 'posts_per_page=-1' ); Just a head up, you shouldn't be using this function here, do whatever you want, but is recommender to use WP_Query or get_posts


0

When you do this: $querystr = "SELECT * FROM `wp_posts` WHERE post_content LIKE '%Alba%' AND post_type='post' OR LOWER(post_title) LIKE '%$nume_searchq%' OR LOWER(post_content) LIKE '%$spec_searchq%' OR LOWER(post_content) LIKE '%$instit_searchq%' LIMIT $limit "; If ANY of the variables are blank ($nume_searchq ...


1

get_posts() doesn't accept posts as input, it only takes argument to query posts. So it's useless and breaking step in your process. It should work if you throw get_posts() out. See Displaying Posts Using a Custom Select Query in Codex for extensive writeup on custom queries. PS your query is seriously insecure, you need to be escaping any untrusted ...


0

thanks for ur code Strik3r ..this helped me a lot..I finally got sorting by custom field to work...in functions.php function sort_meta_query( $query ) { if ( $query->is_archive || $query->is_category || $query->is_home ){ $query->query_vars["meta_key"] = 'fastest_speed_experienced'; $query->query_vars["orderby"] = 'meta_value_num'; } ...


0

I ended up going with a different approach which is a lot easier. I created a new custom user_meta called review_completed. This user_meta contains an Array of the post IDs of the submissions that they have reviewed. Then I simply added a new line to my review_args as seen below. $user_review_completed = get_user_meta($current_user_id, 'review_completed', ...


1

pre_get_posts and WP_Query uses the exact same parameters, so if you need to know which parameters you can use with pre_get_posts, simply visit the WP_Query page in the codex. There is another trick which you can use to get all the parameters (query_vars) you can use. Just add this on the page that you need to get the query_vars from, refresh the page, and ...


0

According to the codex for WP_Query, you should be able to tack on some meta related arguments to your args array (this is untested): $review_args = array( 'orderby' => 'post_date', 'order' => 'ASC', 'posts_per_page' => '1', 'cat' => 22, 'meta_query' => array( 'key'=>'reviewed_by', ...


0

Please check the category parameters in the WP_Query documentation.



Top 50 recent answers are included