Get a list of ACF Repeater-Fields as array

Holy loop attack Batman! I think you can simplify this a lot: $the_posts = get_posts( array( ‘posts_per_page’ => ‘-1’, ‘post_type’ => ‘artists’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘date’, ‘value’ => date( ‘Ymd’ ), ‘compare’ => ‘<‘, ), ) )); $the_list = array(); foreach ( $the_posts as $the_post ) { if ( … Read more

Different Loop for tag pages?

Your code is trying to use if statements to control which if statements are being used, etc, which is meta programming. It will not work, and it can never work. <?php if ( is_tag() ) { if ( have_posts() ) { while ( have_posts() ) { the_post(); } else { $paged = ( get_query_var(‘paged’) ) … Read more

Display specific page (that is child) content on parent page

You were being too specific/not passing the correct parameters into your wp_query. This should get you what you’re looking for: <?php $current_page_id = get_the_id(); $investor_content_query = new WP_Query( ‘post_parent’=> $current_page_id ) ); if ( $investor_content_query->have_posts() ) { while ( $investor_content_query->have_posts() ) { $investor_content_query->the_post(); the_content(); } } wp_reset_postdata(); ?>

Loop categories by recent post

First set a function to be used later with a usort to sort the categories by date of most recent post: function orderByDate( $a, $b ) { return strtotime($a[‘date’]) – strtotime($b[‘date’]); } Get your categories as you were doing: $args = array( ‘hide_empty’=> 1 ); $categories = get_categories($args); $categoriesWithDates = array(); // Create an array … Read more

How to Order By Two Custom Fields?

You can try this by using meta query to filter results and then adding orderby to order results. Below arguments should work $args = array( ‘post_type’ => array(‘post’, ‘video’), ‘meta_key’ => ‘pp_like_count’, ‘orderby’ => ‘meta_value_num’, “meta_query” => array( array( “key” => “pp_lang”, “value” => “english”, “type” => “CHAR”, “compare” => “=” ), ), );