Add a specific part of current category page url to shortcode
I have the following URL: website.com/category/xyz, where xyz can be hundreds of different words.
I use a table plugin for displaying my content all throughout the website, and I want it to filter me categories on each category pages as well. The table works with shortcodes, as follows: [tableshortcode id="120" filter=’xyz’].
I would like to place the category id of the current url, into the filter part of the shortcode.
Right now I’m only able pull the shortcode with the following code:
<?php echo do_shortcode("[tableshortcode id="120" filter='xyz']"); ?>
Any answers, solutions would be much appreciated.
Leave an answer