Categories
CMS Development Wordpress

WP_Term_Query order by ACF, then Title

I added a sequence field to a taxonomy with ACF. I read here that wp_list_categories() creates an instance of the WP_Term_Query class. I can orderby the category listing based on the ACF field with the following code <?php /** * The Template for displaying project archives category list at single hierarchy level. * * * […]

Categories
CMS Development Wordpress

Get Post from CPT group by custom field

I have a custom post type forderung with a custom post field ebene . id | title | ebene 1 | post1 | horror 2 | post2 | action 3 | post3 | horror 4 | post4 | comedy Now i want to list all posts and GROUP by ebene comedy – post4 horror – […]

Categories
CMS Development Wordpress

Is there a way to extract a single post better than using get_posts()?

I have code like the following to extract data about a post: $args = array( ‘post_type’ => ‘products’, ‘numberposts’ => – 1, ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘release_date’, ‘order’ => ‘DESC’, ‘meta_query’ => array( array( ‘key’ => ‘status’, ‘value’ => ‘production’, ) ) ); $latest_products = get_posts($args); echo ‘Our latest product is ‘ . $latest_products[0]->post_title; […]

Categories
CMS Development Wordpress

Query BETWEEN timestamps (today and in a custom field)

I am using wordpress 5.3.2 and advanced custom fields pro Version 5.8.7. My custom field is called timestamp. See below my ACF configuration: I tried to query the db like the following: $today = new DateTime(); $timestToday = $today->getTimestamp(); $timestPlus1 = strtotime(‘+1 days’, $timestToday); $args = array( ‘post_type’ => ‘Calendar-Events’, ‘posts_per_page’ => -1, ‘post_status’ => […]

Categories
CMS Development Wordpress

Order by two meta keys

I have this code which works fine: $args = array(‘post_type’ => ‘brands’,’meta_query’ => array( array( ‘key’ => ‘br_type’, ‘value’ => ‘Aviation’)),’posts_per_page’ => -1,’meta_key’ => ‘br_name’,’orderby’ => ‘meta_value’,’order’ => ‘ASC’,’fields’ => ‘ids’); However, I need to order first by ascending order by another custom field “br_category” and then by the name br_name. I am not sure […]

Categories
CMS Development Wordpress

Order by two meta keys

I have this code which works fine: $args = array(‘post_type’ => ‘brands’,’meta_query’ => array( array( ‘key’ => ‘br_type’, ‘value’ => ‘Aviation’)),’posts_per_page’ => -1,’meta_key’ => ‘br_name’,’orderby’ => ‘meta_value’,’order’ => ‘ASC’,’fields’ => ‘ids’); However, I need to order first by ascending order by another custom field “br_category” and then by the name br_name. I am not sure […]

Categories
CMS Development Wordpress

Order by two meta keys

I have this code which works fine: $args = array(‘post_type’ => ‘brands’,’meta_query’ => array( array( ‘key’ => ‘br_type’, ‘value’ => ‘Aviation’)),’posts_per_page’ => -1,’meta_key’ => ‘br_name’,’orderby’ => ‘meta_value’,’order’ => ‘ASC’,’fields’ => ‘ids’); However, I need to order first by ascending order by another custom field “br_category” and then by the name br_name. I am not sure […]

Categories
CMS Development Wordpress

Sort posts of a particular category based on custom date field value, and display in ascending order

I’m working on displaying a listing of posts that have a an advanced custom field Date Picker, and I need to display all upcoming posts in ascending order. So far I can get the wp_query to show all upcoming posts in descending order (i,e. Dec 26 2019, Dec 13 2019, Nov 26 2019), but this […]