I got it working by using setting the value of the option to advocacy, and then running a .change() function, but I’m wondering if there is a more elegant way.
Here’s what I’m doing, it works but it’s not super elegant.
I’m grabbing a value from the Url, in this case website.com#advocacy.
Then I set advocacy as the option value, then I run a change function after. This basically does an auto select of the advocacy option right after load, so it does flash the original sort. But at least it mostly works.
‘
<script type=”text/javascript”>
jQuery(window).bind(“load”, function () {
var selector = ‘select[name=”ptp_filter_library_category”]’;
var hash = window.location.hash.substr(1);
var optionHash = ‘ option[value=”‘ + hash + ‘”]’;
var combined = jQuery(selector + optionHash);
if (combined.length > 0){
//console.log(‘exists’);
jQuery(selector).val(hash);
combined.change();
}
});
</script>`
Hi,
Sorry for the delay replying to you.
Is your question regarding this free plugin or our “premium” plugin Posts Table Pro? I assume it must be Posts Table Pro as the filter you’re referring to isn’t available in the free plugin.
There isn’t a way to filter the table automatically on load I’m afraid. The way you’re currently approaching it might be the best option. There are options to filter the table by search term and you can display a table for a certain category or categories, but I don’t think that will achieve what you’re trying to do here.
If you have any follow up questions on this, please could submit this via our Support Center.
Thanks very much for your understanding.
Regards,
Andy