Grunion_Contact_Form_Plugin::get_feedbacks_as_options PHP Method

get_feedbacks_as_options() protected method

Returns a string of HTML
protected get_feedbacks_as_options ( ) : string
return string a string of HTML
    protected function get_feedbacks_as_options()
    {
        $options = '';
        // Get the feedbacks' parents' post IDs
        $feedbacks = get_posts(array('fields' => 'id=>parent', 'posts_per_page' => 100000, 'post_type' => 'feedback', 'post_status' => 'publish', 'suppress_filters' => false));
        $parents = array_unique(array_values($feedbacks));
        $posts = get_posts(array('orderby' => 'ID', 'posts_per_page' => 1000, 'post_type' => 'any', 'post__in' => array_values($parents), 'suppress_filters' => false));
        // creates the string of <option> elements
        foreach ($posts as $post) {
            $options .= sprintf('<option value="%s">%s</option>', esc_attr($post->ID), esc_html($post->post_title));
        }
        return $options;
    }