New answers tagged

3

So if i understand you correctly, you want to sort by a value that has to be calculated based on the currency? You can do this, but not within a wordpress wp_query of sorts. Instead you can do one of two things: Method 1: The "do more now, have less hassle later"-way: On saving the currency and price in your save_post action, you calculate the AED-price ...


0

Yeah, so: First: you should not use query_posts. No, not even if you need ajax pagination. However, this is not your current problem. To be able to sort the "price on request" Properties to the end of the list regardless of the price-sorting, you simply need to save the "price on request" information in another meta field. The reason you need to do this is ...


0

Add code in your theme function.php file function comment_validation_init() { if(is_single() && comments_open() ) { ?> jQuery(document).ready(function($) { $('#commentform').validate({ rules: { author: { required: true, minlength: 2 }, email: { required: true, email: true }, comment: { required: ...


0

I think using the pre_get_posts action should do the trick. Something along these lines. Modify as needed. Add to functions.php. function my_limit_admin_posts($query){ if ( is_admin() && $query->is_main_query() && 'your_post_type' === $query->get('post_type') && current_user_can('some_capability_or_role') ) { $query->...


0

You can use meta_query property when fetching post data using new WP_Query() $vehicles = new WP_Query([ 'post_type' => 'vehicle', 'meta_query' => [ 'relation' => 'AND', [ 'key' => 'wheel', 'value' => '4', ], [ 'key' => 'color', 'value' => 'blue',...


1

Thanks! We ran into the same issue and this question helped a lot! Alternate Use Case We're looping through a custom post type called events (surprise, surprise, it stores events). It stores a timestamp in the meta field ev_start (event start time). We actually were able to just use the orderby value meta_value_num (as you can see meta_type is commented out)...


0

I finally found some helpful information in this post: How to "Load More" posts via AJAX? The issue ended up being a combination of counting the number of total pages of posts, and sharing that number with the hooked ajax function in functions.php. Here's my page template loop: <div class="events"> <?php $socal_cats = array( '...


1

It looks like your query is for ALL posts in that post type as you are overwriting $posts when using $posts = get_posts(). You need to pass the Taxonomy parameter correctly as explained here like this: $args = array( 'post_type' => 'post', 'tax_query' => array( array( 'taxonomy' => 'people', 'field' => '...


Top 50 recent answers are included