WooCommerce custom brands

If you want to add brands to your WooCommerce, you can follow the workflow below.

Preparing the brands back-end system

01. Download and activate Types plugin.

02. In your dashboard, go to Types / Custom Types and Taxonomies and press Add Custom Taxonomy.

03. Fill the following fields as show below:

  • Custom taxonomy name plural (required) : Brands
  • Custom taxonomy name singular (required): Brand
  • Slug (required) : brand
  • In the Select Post Types area, tick the Product checkbox.
  • In the Options area, tick the Hierarchical – like post categories, with parent / children relationship and checkboxes to select taxonomy.

04. If you want to add images to your brands, you can use the Sideways8 Simple Taxonomy Images plugin.

05. The backend branding system is ready to accept your new brands! Go to Products / Brands and add the desired brands.

Creating a page to display your brands in the front-end

01. Create a file brands.php and place it in your theme folder.

02. Open the file, and paste the code below:

<?php
/**
 * Template Name: Brands
 */
get_header();
?>
<ul class="products">
    <?php
    $terms = get_terms('brand');
    foreach ($terms as $term) {
        $term_link = get_term_link($term);
        ?>
        <li class="product">
            <a href="<?php echo $term_link; ?>">
                <?php
                $image_src = s8_get_taxonomy_image_src($term, 'thumbnail');
                ?>
                <img src="<?php echo $image_src['src']; ?>">
                <h3>
                    <?php
                    echo $term->name;
                    ?>
                </h3>
            </a>
        </li>
        <?php
    }
    ?>
</ul>
<?php
get_footer();
?>

03. Create a new page in your WordPress backend. Name it Brands, and select the template that we created in step 2.

04. The page is ready. Preview it to see the brands with their titles, images and urls.

Post A Comment

Anti-Spam Quiz: