Home › Forums › MapPress Support › Show only current categories › Reply To: Show only current categories
May 31, 2013 at 5:26 am
#12724
Hi,
I haven’t heard back from you so I assume the code is working? For anyone else who needs this, here’s the code to pick up the category from the current post:
<?php
$cats = get_the_category();
if (isset($cats[0]) && $cats[0]->slug != 'uncategorized') {
$cat = $cats[0]->cat_ID;
$query = "posts_per_page=-1&cat=$cat";
$shortcode = '[mashup query="' . $query . '" poilist="true"]';
echo do_shortcode($shortcode);
}
?>