Change posts archive ordering
Scrap this figured it out! A plugin was overriding these settings on the specific archive I need it on! So probably without the plugin, the above would work 🙂
Scrap this figured it out! A plugin was overriding these settings on the specific archive I need it on! So probably without the plugin, the above would work 🙂
Include post_type parameter in your search query. Please see this link for more detailed examples
It works … here is the code function updateNumbers() { /* numbering the published posts: preparation: create an array with the ID in sequence of publication date, / / save the number in custom field ‘article’ of post with ID / / to show in post (within the loop) use <?php echo get_post_meta($post->ID,’article’,true); ?> / … Read more
Interesting question. Wp_Query will return all posts that match the criteria. To enhance performance, you can switch off pagination with no_found_rows=true. You want both pagination and limit the amount of results returned. That’s not something wp_query can deliver. So the most obvious though not too elegant solution would be to modify your loop in the … Read more
Can you verify that $_POST[‘name’] is obtaining a value. I suggest echoing it out to the page for debugging (maybe in comment tags if site is live). If $_POST[‘name’] is empty, then all results will be returned because the query will say user_nicename LIKE ‘%’ Just as a precaution in any case, you should do … Read more
You’ll have to get the terms of current post with get_the_terms function and then use them in your query. // this will get terms and then get only term_ids from them $term_ids = wp_list_pluck( get_the_terms( get_the_ID(), ‘coupon_category’ ), ‘term_id’ ); $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $related = new WP_Query( array( ‘post_type’ => APP_POST_TYPE, … Read more
Are you sure the $_GET[‘q’] param is set? Try: $s_string = ( isset($_GET[‘q]) && !empty($_GET[‘q’]) ) ? sanitize_text_field($_GET[‘q’]) : ”;
I don’t think ACF has a built-in function to do what you want. You can use get_field to retrieve a value from any post, but it requires a post ID if you want the value from anything other than the current post. So instead, we can query posts using WP_Query and pass the meta key … Read more
Your sorting parameter should be: ‘orderby’ => ‘title’
you can use the ‘category__in’ in WP_Query; example: $feed = WP_Query(array(‘category__in’ => array(102), ‘posts_per_page’ => 3, ‘order’ => ‘DESC’));