Reply To: Show only current categories

Home Forums MapPress Support Show only current categories Reply To: Show only current categories

#12724
Chris
Keymaster

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 != &#039;uncategorized&#039;) {
        $cat = $cats[0]->cat_ID;
        $query = "posts_per_page=-1&cat=$cat";
        $shortcode = &#039;[mashup query="&#039; . $query . &#039;" poilist="true"]&#039;;
        echo do_shortcode($shortcode);
}
?>