<?php

/**
 * IRIS OpenWebsite knowledge base list
 *
 * This function creates a list of knowledge
 * base questions and answers based on the
 * word/words that the user has searched for.
 *
 * @function search_iris_wordpress_help()
 *
 * @param N/A
 *
 * @return (string) A list of help questions and answers
 *
 * @since 1.0.0 
 *
 */
function iris_wordpress_help( $category = '' ) {
	
	global $iris_db;
	
	$help_array = $iris_db->get_results( "SELECT * FROM iris_wordpress_help WHERE category LIKE '%$category%' ORDER BY title" );
	echo '<table class="striped fixed widefat"><thead><tr><th width="25%">Title</th><th>Description</th><th width="25%">Categories</th></tr></thead><tbody>';

	foreach ( $help_array as $help_item ) {
		
		echo '<tr><td class="row-title"><strong>' . $help_item->title . '</strong></td><td>' . wpautop( $help_item->description ) . '</td><td>' . $help_item->category . '</td></tr>';
	}
	echo '</tbody></table>';
}