• Resolved Jason Wong

    (@eljkmw)


    @titodevera

    As far as I know, your plugin automatically filters products to their allocated brand page(s). If I were to add or customise these page(s), must these be created separately and then use your plugin shortcodes to list the products accordingly?

    Please advise. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor titodevera

    (@titodevera)

    PWB uses WordPress taxonomies for assign brands to products. By default, there are an archive page for each brand where you can see the products assigned to the mentioned brand. You can configure a specific banner (and a link) for each brand page (go to Admin->Products->Brands). Also you can customize each brand page separately adding some CSS to your theme, using some conditional tags, or using WordPress template hierarchy (creating taxonomy-pwb-brand-nike.php for example)

    ??

    • This reply was modified 8 years, 6 months ago by titodevera.
    • This reply was modified 8 years, 6 months ago by titodevera.
    Thread Starter Jason Wong

    (@eljkmw)

    @titodevera,

    Thank you for responding.

    I’m somewhat confused here. Does it mean that I don’t need to create any new pages via wp-admin specifically for each brand? But instead create custom templates like taxonomy-pwb-brand-brand_name.php, if I wish to have more than one banner. If so, in which folder must the templates be saved into? Besides, I’m using a child-theme as the active theme.

    Plugin Contributor titodevera

    (@titodevera)

    Is not necessary to create any new page, you can modify the existing brand page.

    If you want to have more than one banner in a certain brand page add this code to your functions.php :

    
    function pwb_extra_banner() {
    
    	$queried_object = get_queried_object();
    
    	if( is_a($queried_object,'WP_Term') && $queried_object->taxonomy == 'pwb-brand' ) {
    
    		$current_term_id = $queried_object->term_id;
    
    		$term_id = 17; //term id of a specific brand
    
    		if( $current_term_id == $term_id ) {
    			$img = get_stylesheet_directory_uri().'/img.png'; //url of the banner
    			echo '<div class="pwb-brand-banner pwb-brand-extra-banner pwb-clearfix">';
    				echo '<a href="#"><img src="'.$img.'"></a>';
    			echo '</div>';
    		}
    
    	}
    
    }
    add_action('woocommerce_before_shop_loop', 'pwb_extra_banner', 10);
    

    Don′t forget to set $term_id and $img according to your needs

    I think this is the nicest solution… not the only one…

    ??

    • This reply was modified 8 years, 6 months ago by titodevera.
    Thread Starter Jason Wong

    (@eljkmw)

    @ titodevara,
    Sorry for the late reply, and many thanks for the snippet. This is indeed awesome.

    (^_^)v

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Must brand pages be created for additional banners?’ is closed to new replies.