Return the Posts that are child of the current Post, only if the Taxonomy is assigned.

global $post;
 
$terms = get_terms( 'your-tax' );
 
foreach( $terms as $term ) {
    wp_reset_query();
    $args = array( 
        'post_type' => 'your-child-post-type',
        'tax_query' => array( array(
                'taxonomy' => 'your-tax',
                'field' => 'slug',
                'terms' => $term->slug,
                 ),
        ),
          
        //get the Custom Field where Types stores the Parent ID
        'meta_key'         => '_wpcf_belongs_{parent-post-slug}_id',
        'meta_value'       => $post->ID,
 
     );
 
     // if the term has associated posts, show the term and its posts
     $query = new WP_Query( $args );
     if( $query->have_posts() ) {
        echo '<h3>' . $term->name . '</h3>';
        echo '<ul>';
        while( $query->have_posts() ) : $query->the_post();
            echo '<li>' . get_the_title() . '</li>';
        endwhile;
        echo '</ul>';
     }
}

 

Types stores the Parent Post ID in a field called _wpcf_belongs_{parent-slug}_id.

So if you are in one single post (Parent Post) you could query your Child Post type and return only Posts where the _wpcf_belongs_{parent-slug}_id is equal to the current viewed Post (parent) ID.

Posts Date older than, or not older than given date

With this small ShortCode you can compare the Views Post Date (returning “U” Timestamp) to any date in past or future.

It’s useful as example if you want to display a “NEW” Tag on posts that are not older than [given date or days]

Function:

function timestamp_in_past_shortcode($atts) {
$timestamp_in_past = strtotime('-1 Week');//here you can use any value
return $timestamp;
}
add_shortcode('date-in-past', 'timestamp_in_past_shortcode');

Then evaluate the above ShortCode against the Views ShortCode

1453802101

Views Custom Query Filter – Check for custom Author cap.

Create a View with parametric search and a plotted map listing posts of a CPT.

All of those posts will have different authors.

All authors will either own a certain capability (managed by the groups plugin that stores these capabilities in the plugin’s own tables) or not.

Retrieve the capability of the author by using this function:

which returns 1 if the author has the capability and 0 if the author does not have the capability.

This wpv_filter_query_post_process now lists the posts of authors who own the capability – means where the above function would return 1.

add_filter( 'wpv_filter_query_post_process', 'prefix_modify_empty_query', 10, 3 );
function prefix_modify_empty_query( $query, $view_settings, $view_id )
{
 
    if ($view_id == 41)
    {
 
        // get some posts (author-profile cpt)
        $args = array(
            'posts_per_page'   => -1,
            'post_type'        => 'author-profile',
            'post_status'      => 'publish',
        );
        $posts_array = new WP_Query($args);
 
        //If there are some posts
        if (!empty($posts_array->posts))
        {
            //build a array for valid (to return) posts
            $valid_posts = array();
 
            //we need to check if the posts author has the correct cap
            foreach ($posts_array->posts as $post_array)
            {
               //this custom code checks wehter the author (user) is / has capability 'pp_speaker'
                require_once( ABSPATH . 'wp-includes/pluggable.php' );
                $groups_user = new Groups_User(get_the_author_meta('ID', $post_array->post_author));
                $can_make_donuts = $groups_user->can('pp_speaker');
 
                if ($can_make_donuts)
                    $valid_posts[] = $post_array;
            }
        }
 
        //If there are posts with this author / cap
        if (!empty($valid_posts))
        {
            //assign the valid posts array to the query
            $query->posts = $valid_posts;
        }
 
    }
 
 
    return $query;
}

List only parent CPT that has childs in a View list

Through wpv_filter_query you can achieve that a View returns only Parent CPT’s which actually have some Childs assigned.

add_filter('wpv_filter_query', 'parent_has_childs_func', 101, 3);

function parent_has_childs_func($query, $view_settings, $view_id) {
 if ( $view_id == XX ) {
  global $wpdb;
  $ids = $wpdb->get_results( "SELECT meta_value FROM wp_postmeta WHERE meta_key = '_wpcf_belongs_city_id'" );
  $query['post__in'] = array($ids);
 }
 return $query;
}

Evaluate for recurring Date

This creates a ShortCode to use when Date CF (Timestamps) need to be evaluated by recurring dates, just as for Birthdays.

Create a CPT, associate a Date CF to it, list CPT in a View and see in the code how to evaluate.
Remember to Register the ShortCode in Views Settings.

function born_today_func( $atts ) {
    extract(shortcode_atts(array(
        'birthday' => get_post_meta(get_the_ID(), 'wpcf-your_slug', true),
 
    ), $atts)
           );
 
    if(((date('d', $birthday)) == date('d')) && (date('m', $birthday)) == date('m')){
        return 1;
    }else{
        return 0;
    }
}
add_shortcode( 'born-today', 'born_today_func' );

Evaluate like this in your view loop: