HI,
is this meant to be category instead of cateogry?
Yes, it is a typo and you can fix it. But it should have still worked this way.
Also, what is this line doing in the code?
add_filter( ‘gmw_pt_tax_query’, ‘gmw_filter_form_by_cateogry_page’, 90, 2 );
gmw_pt_tax_query is a filter that executes the function gmw_filter_form_by_cateogry_page(). The function should change the value of the taxonomy argument.
Here you can read more and learn about WordPress hooks ( actions and filters ).
Will this apply to all of the forms or just [gmw form=”1″]
The above will apply to all forms. You can limit it to a specific form, for example form with ID 1, using the below:
function gmw_filter_form_by_cateogry_page( $tax_args, $gmw ) {
if ( $gmw['ID'] != 1 ) {
return $tax_args;
}
// enter the taxonomy slug for example 'directory_categories'
$taxonomy = 'directory_categories;
// enter the term slug that you'd like to display. For example 'wine_and_dining'
$term_slug = 'wine_and_dining';
// create the filter based on taxonomy and terms ID
$tax_args = array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $term_slug,
)
);
return $tax_args;
}
add_filter( 'gmw_pt_tax_query', 'gmw_filter_form_by_cateogry_page', 90, 2 );
and I can just put that code in the page?
You need to add the code to the functions.php file of your theme or child theme and change the value of $taxonomy and $term_slug in the function based on your needs.