Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi,

    I have hacked this functionality in to the code for one of my sites, I hope this helps you.

    Insert this into includes/location.class.php line 124

    $ml_cats = get_the_category();
    	        foreach( $ml_cats as $ml_cat )
    	        {
    	        	$categories[] = $ml_cat->term_id;
    	        }
    
    					$categories = array_merge(array('all'), $categories);
    
    	        $args['meta_query'][] = array(
    	            'key' => 'ml_advert_categories',
    	            'value' => $categories,
    	            'compare' => 'IN'
    	        );

    and includes/metaboxes.php line 31

    // categories
    	$categories = get_terms('category');
    	$all_categories = array();
    
    	foreach ($categories as $category) {
    		if($category->parent)
    		{
    			$parent = get_category( $category->parent);
    			$long_name = $parent->name . ' / ' . $category->name;
    		}
    		else
    		{
    			$long_name = $category->name;;
    		}
    
    		$all_categories[ $category->term_id ] = $long_name;
    	}
    
    	asort($all_categories);
    
    	$all_categories = array('all' => 'All Categories') + $all_categories;

    and then before the “Tag Archives *” section in the same file

    array(
    				'name' => 'Categories *',
    				'desc' => 'Select categories on which to display advert',
    				'id' => $prefix . 'categories',
    				'type' => 'multicheck',
    				'options' => $all_categories
    			),
Viewing 1 replies (of 1 total)