View Single Post
  #23  
Old March 17th, 2012, 09:09 AM
lesljr lesljr is offline
 
Join Date: Jan 2012
Posts: 80
Default

how do i use the code to set a dynamic filter without the drop drop down. I want it to look like the filter by price with the url. I know I need to change $html to

$html .= <li><a href="URL_QUERY">'.ucwords($brands->brand).'</a></li>

but I'm not sure of the syntax for the url.

Quote:
Originally Posted by Eric View Post
Here's an example of how to remove brands from the list. I've removed 'Adidas' and 'Atlas'. This example also shows how to capitalize the first letter in each word of the brand.
PHP Code:
function dfr_get_brands() {
    global 
$wpdb;
    
$brands $wpdb->get_results("SELECT brand FROM ".$wpdb->prefix."dfr_shop_products 
    WHERE brand NOT IN('Adidas','Atlas') 
    GROUP BY brand"
);
    
$html '';
    foreach (
$brands as $brands) {
        
$html .= '<option value="'.$brands->brand.'">'.ucwords($brands->brand).'</option>';
    }
    return 
$html;