/**
     * Get posts that are using any Content Template.
     *
     * @param string|array $post_types An array of post type slugs or one post type slug.
     * @param string $output_format Determines what return value will be:
     *     - 'by_post_type' will produce an associative array where keys are post types and values
     *         are arrays of post IDs.
     *     - 'flat_array' will produce an array of post IDs
     *     - 'count' will return a single number - count of posts of given types.
     *
     * @return array|null Null on error, otherwise determined by $output_format.
     *
     * @since 1.9
     */
    static function get_posts_using_content_template_by_type( $post_types, $output_format = 'flat_array' ) {
        global $wpdb;

        // As opposed to get_dissident_posts(), there is no LEFT JOIN, which should exclude posts without
        // assigned CT right away.
        $query = "SELECT %s
            FROM {$wpdb->posts} AS posts JOIN {$wpdb->postmeta} AS meta
              ON (
                  posts.ID = meta.post_id
                  AND meta.meta_key = '_views_template'
              )
            WHERE
              posts.post_status != 'auto-draft'
              AND posts.post_type IN ( %s )
              AND meta.meta_value != 0";

        return WPV_Content_Template_Embedded::query_assigned_posts( $post_types, $output_format, $query );
    }