• Resolved thomann061

    (@thomann061)


    I can select a location for each ad, but they are not displaying on my single ad page. What are some ways to accomplish this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter thomann061

    (@thomann061)

    Can someone share a custom example of how to query location categories?

    • This reply was modified 6 years, 2 months ago by thomann061.
    • This reply was modified 6 years, 2 months ago by thomann061.
    Plugin Author Farhan Noor

    (@farhannoor)

    Hi,
    To query all the terms of location taxonomy, paste given code in your theme’s single post template file e.g. single.php or single-aol_ad.php:

    
    function get_my_filters($tax){
      global $post;
      $pid = $post->ID;
      $types = get_aol_ad_types();
    
      if(!in_array($post->post_type, $types)) return array();
    
      $terms = get_terms(array('object_ids' => $pid , 'hide_empty' => TRUE, 'taxonomy' => $tax));
      
      if(empty($terms)) return array();
      
      $term_names = array();
      foreach($terms as $term){
          $term_names[] = $term->name;
      }
      return $term_names;
    }
    
    print_r(get_my_filters('aol_ad_category'));
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to Show Location Categories on Ad Page’ is closed to new replies.