Support reply may delay for 3 weeks due to corona virus outbreak, please send us email to support@pickplugins.com
Ticket for: Post Grid
0
Anonymous
Jun 05, 2020 04:41 AM 1 Answers
Member Since Jan 1970
Unsolved Solved Mark as Solved Mark as Unsolved
Subscribed Subscribe Not subscribe
Flag(0)

I am using Post Grid plugin to display a catalog for a record company using custom post types and taxonomies. They want to be able to filter by artist and genre on the front end, and I have looked at the Post Grid documentation to find a shortcode php file that you can use to add this to a widget in my sidebar. I've gotten most everything to work, it shows up in the sidebar widget using the shortcode i generated, the 2 dropdowns are there for artist and genre, and they correctly populate in the dropdown based on the current taxonomies present. I can NOT for the life of me figure out how to make it actually filter the data after pressing 'submit' and it just shows everything unfiltered. Here is the code I am using.

<form action="#" method="get">

'artist',
'hide_empty' => false,
) );

//var_dump($terms);
$pgs_artist = isset($_GET['pgs_artist']) ? sanitize_text_field($_GET['pgs_artist']) : '';

?>

Filter by Artist

term_id) ? $term->term_id : '';
$term_name = isset($term->name) ? $term->name : '';

?>
<option value="">

'genre',
'hide_empty' => false,
) );

//var_dump($terms);
$pgs_artist = isset($_GET['pgs_genre']) ? sanitize_text_field($_GET['pgs_genre']) : '';

?>

Filter by Genre

term_id) ? $term->term_id : '';
$term_name = isset($term->name) ? $term->name : '';

?>
<option value="">

<?php

}

// Process form data and post query

function post_grid_query_custom_search($query_args, $args){

$current_post_id = get_the_ID();

$pgs_artist = isset($_GET['pgs_artist']) ? sanitize_text_field($_GET['pgs_artist']) : '';
$pgs_genre = isset($_GET['pgs_genre']) ? sanitize_text_field($_GET['pgs_genre']) : '';

$query_args['s'] = $pgs_artist;

return $query_args;
}

add_filter('post_grid_query_args','post_grid_query_custom_search', 90, 2);

0 Subscribers
Submit Answer
Please login to submit answer.
1 Answers
Sort By:
Best Answer
0
PickPlugins
Jun 05, 2020
Flag(0)

Welcome to our forum.

Could you please share your link where you trying? i can see the code has many errors, probably not used correctly, if possible please send me a temporary admin access to your site, i will check the issue.

Regards

pathosmusic
- Jun 08, 2020 09:01 PM
Flag (0)
0

Before I send you that info, is there a way to just show the filter above the post grid? I found your addon for plugin 'post-grid-search-master' but how do I add the filters for custom taxonomies instead of just category and tag?

Sign in to Reply
Replying as Submit