Support » Fixing WordPress » exculde category with get_the_category

  • OK, just so you know I did find a post similar to this but it did not solve my problem and made me more confused. The code I am using looks like this.

    <?php
    $categories = get_the_category();
    $cat_ids = array();
    foreach( $categories as $category ) {
      $cat_ids[] = $category->cat_ID;
    }
    $map_args = 'width=590&height=300&map_content=global&open_post_id=' . get_the_ID() .
      '&marker_select_center=true&marker_select_highlight=true' .
      '&marker_select_highlight=true&marker_select_attachments=true' .
      '&map_cat=' . implode(',', $cat_ids);
    echo GeoMashup::map( $map_args );
    ?>

    Basically, it looks at the current post and identifies the categories and then uses them for a map plugin I am using. It works fine but say the current post has two categories, a parent category and a child category. It maps both of them but I really only want it to map the child. Is there a way to exclude the parent. Also, this parent category is always the same.
    Thanks,
    Michael

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘exculde category with get_the_category’ is closed to new replies.