Hi Tkhan,
All the search parameters are contained in an array called $args.
If you add print_r($args); to your search template and run a search you’ll see a listing of all the parameters you can access.
Thread Starter
tkhan
(@tkhan)
Hi,
Have tried ‘print_r($args);’ as suggested, unfortunately the category and style are in id format. For instance if I use ‘print_r($args[category]);’ it prints the category id of 73.
Although I have managed to sort this for the categories as they are taxonomies by using
‘$array = get_term_by(‘id’, $_POST[‘category’], ‘event-categories’, ‘ARRAY_A’);print_r($array[name]);}’
it doesn’t work for the styles which are generated via the ‘CREATING AN EVENTS MANAGER ADD-ON : A COMPLETE WALKTHROUGH’ tutorial and are not taxonomy terms.
Any pointers would be fantastic.
Tkhan
Can post the code you’re using?
Thread Starter
tkhan
(@tkhan)
Hi caimin_nwl
wasn’t sure what code you are referring to the code used to create the styles as per walkthrough or the code used to produce the output. To create the output I am using the events-list.php.
As mentioned above ‘$args’ produces [category] => 73 [style] => 2.
my events-list.php is as follows:
‘$args = apply_filters(’em_content_events_args’, $args);
if( get_option(‘dbem_css_evlist’) ) echo “<div class=’css-events-list’>”;
$array = get_term_by(‘id’, $_POST[‘category’], ‘event-categories’, ‘ARRAY_A’); print_r($array[name]);
print_r($args[style]);
echo EM_Events::output( $args );
if( get_option(‘dbem_css_evlist’) ) echo “</div>”;’
I can output each of the styles using
‘$my_em_styles = (is_array(get_option(‘my_em_styles’))) ? get_option(‘my_em_styles’):array();
printArray2($my_em_styles);
function printArray2($array){
foreach ($array as $key => $value){
echo “$value”;
}
}’
unfortunately this prints all the style names and is not restricted to those searched for, would it be possible to modify the top line to include only search values.
Sorry for asking so many questions its not that important really, just really annoying when you get a idea and don’t know have a clue how to implement it.
Thanks again Tkhan.