Get Latest GPL & Premium Version Blogger Template, WordPress and WooCommerce Extensions...
Home » Plugins » FacetWP Color Add-On
Description

FacetWP Color Add-On

A FacetWP facet to filter products by color

Filter results by color

FacetWP Color facetThe Color facet type allows users to filter posts or products by color.

The facet creates clickable rectangular color swatches from the color values in the Data source field.

Depending on the Behavior setting, selecting multiple color swatches narrows or widens the displayed result set. A second click on a selected color swatch resets that choice.

Available options

NameDescription
Data sourceChoose a Data source that contains a valid color value. This can be a custom field, a category or custom taxonomy, or – if you are using WooCommerce – a product attribute. For using taxonomies and product attributes, see below.

Valid color values are:

  • An existing color keyword (for example: blue). Note: valid color keywords never contain spaces.
  • hexadecimal (hex) color value, normally consisting of a hash-sign with 6 digits (#0099FF). Also valid are 3-digit shorthand values (#09F) and 8-digit hex values, where the last 2 digits contain an alpha value for the transparency (for example: #0099FF50, which is a 50% transparent #0099FF). If you are using hex color values, make sure they always start with #
  • An rgb value (rgb(0,153,255)) or rgba value (for example: rgba(0,153,255,0.5), where 0.5 means 50% transparent)
BehaviorNarrow the result set – when selecting multiple colors, only display results matching all selected colors:

Widen the result set – when selecting multiple colors, display all results matching any selected colors:

CountThe maximum number of color choices to show. Use -1 for no limit. However, note that FacetWP limits the maximum count at 1000 for usability and performance reasons.
Soft limitThe number of choices before showing a “See {num} more” / “See less” link. link. Set to 0 to display all options. Note: this label is translatable with the facetwp_i18n hook, with __(), or with the gettext filter.

Using a custom taxonomy or WooCommerce product attribute as Data source

In the Color facet’s settings, you can choose a taxonomy as the Data source. This can either be a custom taxonomy, or – if you are using WooCommerce – a global product attribute, which is also stored as a custom taxonomy.

When a taxonomy is set as Data source, FacetWP treats color values as follows:

  • Term names are used to generate the display of the facet’s color swatches. This means that the term names must be a valid color value. (Technically, the term names are stored in FacetWP’s index table as facet_display_value).
  • Term slugs are used for filtering, which means they will show up in the url after interacting with the Color facet. (Technically, the term slugs are stored in FacetWP’s index table as facet_value).
FacetWP Color facet using taxonomy terms or WooCommerce product attributes as data source
When using a custom taxonomy or WooCommerce product attribute to store Color facet values, term names are used to display the colors, while term slugs are used for filtering and the url.

You can use the same color value for the term name and term slug, but keep in mind that WordPress removes spaces, commas and other special characters when it auto-generates the term slug from the term name. For example, if the color value in the term name is set to rgb(255,0,0), the auto-generated term slug will become rgb25500. This will work, but to make the filtered url look more readable, you can manually change the term slug to red, which – for a facet with name “color” – will make the url look like: /?_color=red.

Using a taxonomy term custom field as data source

With Advanced Custom Fields or Pods, you can add custom fields to taxonomy terms. If you set such a custom term field as the data source for the Color facet, you will notice that the facet does not display any choices. This is because custom fields attached to taxonomy terms cannot be indexed directly by FacetWP.

However, with a bit of custom code, using a custom term field as data source is possible. See this section on the Advanced Custom Fields page for instructions.

Integrations

The Color facet integrates with several WooCommerce ‘color swatches’ plugins:

Variation Swatches for WooCommerce

The Variation Swatches for WooCommerce plugin by Emran Ahmed lets you attach colors or images to your WooCommerce product attributes. When adding a facet, set its Data Source to the product attribute containing your custom color/image swatch.

Add support for dual colors

Variation Swatches for Woocommerce Pro - dual color swatches
Dual colors in a Color facet with Variation Swatches for WooCommerce Pro

If you are using the Pro version of this plugin, you have the option to use “dual color” swatches in attributes with type “Color”. Dual-color swatches have a primary and a secondary color, displayed together in one swatch, with a 45-degree separation angle.

With a bit of custom code, it is possible to let these dual colors show up in a Color facet.

Add support for color groups

The Pro version’s “color groups” feature also can be used with FacetWP. With a bit of custom code it is possible to let FacetWP index these color groups instead of the individual colors.

WooCommerce Attribute Swatches

The WooCommerce Attribute Swatches plugin by IconicWP also lets you attach colors or images to your WooCommerce product attributes, similar to the Variation Swatches for WooCommerce plugin.

Display the color names next to the color swatches

How to show color names next to the color swatches in a color facet.

Add the following code to your (child) theme’s functions.php to add the color names next to the color swatches.

This example uses $result['facet_value'] to retrieve the color’s name, which is the term slug if your color source is a taxonomy.

Depending on your source field setup you may need to use $result['facet_display_value'] (which is the term name in a taxonomy). Or you can use $result['term_id'] to lookup a custom field saved for the taxonomy term.

How to use custom PHP code?

PHP code can be added to your (child) theme’s functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( ‘facetwp_facet_option’, function( $item, $result, $params ) {
$classes = ;
if ( $result[‘overflow’] ) {
$classes = ” facetwp-overflow facetwp-hidden”;
}
$item = str_replace( ‘<div’, ‘<div class=”facetwp-color-item’ . $classes . ‘”><div’, $item );
$item = str_replace( ‘</div>’, ‘</div><div class=”facetwp-color-name”>’ . $result[‘facet_value’] . ‘</div></div>’, $item );
return $item;
}, 11, 3 );

Additionally, add the following CSS to put each color plus its name on a single line:

How to use custom PHP code?

PHP code can be added to your (child) theme’s functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_action( ‘wp_head’, function() {
?>
<style>
.facetwp-color-item {
margin: 0 0 12px 0;
display: block;
}
.facetwp-color-item.facetwp-hidden {
display: none;
}
.facetwp-color-item .facetwp-color {
margin: 0;
float: left;
}
.facetwp-color-item .facetwp-color-name {
display: inline-block;
margin-left: 10px;
line-height: 30px;
white-space: nowrap;
}
</style>
<?php
}, 100 );

Add result counts to Color facet swatches

How to add result counts to the color swatches in a color facet.

By default, Color facet choices do not display result counts. Add the following code to your (child) theme’s functions.php to add counts to the right of the color swatches:

How to use custom PHP code?

PHP code can be added to your (child) theme’s functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( ‘facetwp_facet_option’, function( $item, $result, $params ) {
$classes = ;
if ( $result[‘overflow’] ) {
$classes = ” facetwp-overflow facetwp-hidden”;
}
$item = str_replace( ‘<div’, ‘<div class=”facetwp-color-item’ . $classes . ‘”><div’, $item );
$item = str_replace( ‘</div>’, ‘</div><div class=”facetwp-counter”>(‘ . $result[‘counter’] . ‘)</div></div>’, $item );
return $item;
}, 11, 3 );

Additionally, add the following CSS:

How to use custom PHP code?

PHP code can be added to your (child) theme’s functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_action( ‘wp_head’, function() {
?>
<style>
.facetwp-color-item {
margin: 0 12px 12px 0;
display: inline-block;
}
.facetwp-color-item.facetwp-hidden {
display: none;
}
.facetwp-color-item .facetwp-color {
margin: 0;
float: left;
}
.facetwp-color-item .facetwp-counter {
display: inline-block;
margin-left: 5px;
line-height: 30px;
}
</style>
<?php
}, 100 );

If you are using the “Soft limit” setting, and want to change or translate the “See {num} more” / “See less” link texts, you can use a translation plugin to change the __() strings, or you can use the facetwp_i18n hook.

Another way is using a gettext filter hook. Add the following code to your (child) theme’s functions.php:

How to use custom PHP code?

PHP code can be added to your (child) theme’s functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( ‘gettext’, function( $translated_text, $text, $domain ) {
if ( ‘fwp-front’ == $domain ) {
if ( ‘See {num} more’ == $text ) {
$translated_text = ‘Show {num} more’;
}
elseif ( ‘See less’ == $text ) {
$translated_text = ‘Show less’;
}
}
return $translated_text;
}, 10, 3 );

WordPress theme,

WordPress plugin,

Woocommerce,

GPL Plugins WordPress,

GPLplugins,

Free WordPress plugins,

Free Woocommerce Plugins,

Reviews (0)
0 reviews
0
0
0
0
0

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

READ FIRST

Our business hours are Monday to Friday from 10:00 am to 4:00 pm (GMT-8), any request made outside these hours will be process until next business day. Support and Updates can take 24 to 48 hours. Support provided is for product installation. Please be aware of possible time zone differences when waiting for our reply.

Updates:
  • To receive an email notification when products have been updated, be sure to click on the notification button below the product image.
  • On a standalone item, you will get lifetime updates. If you choose a membership, updates and access to your items will be available as long as your membership is active.
  • We regularly update products as soon as we are notified about an update, we go and download it from the author and update it on our site, but In case the current version of the product is not the latest, You can request an update for the product.
  • We send regular emails advising when products have been updated so please be sure to provide an active email address when you sign up.
Support:
  • If you have any question or need help installing products purchased on our website, please don’t hesitate to contact us.
  • Please note that we are not developers of the provided products, so our technical support capabilities are limited. We do not change product functionality and do not fix developer bugs.
  • We don’t offer any additional author services like author’s support and license keys and we are not affiliated or in any way related to third-party developers or trademark owners. If you want to know more about GNU / GPL License, CLICK HERE.
Abuse Warning:
  • Please note that accounts are monitored and redistribution of our content is not allowed and will not be tolerated.
  • Our system may detect patterns of downloading items from non-end users outside of our fair use policy.
  • Any violation of our terms of use will result in permanent account suspension and no refunds will be issued.
  • Subscriptions can be cancelled at any time from your account control panel.
  • Downloads are strictly subject to our fair use policy.
For more information please read FAQs & Terms of Service.
FOR DAILY UPDATES & SUPPORT
FOLLOW US HERE
Activation

NOTE: 

  • All The Products Are From Original Author
  • All The Files Would Be Untouched And Unmodified
  • Unlimited Website Usage
  • Files Scanned By Norton And Mcafee
  • Free New Version
  • License : GPL
FOR DAILY UPDATES & SUPPORT
FOLLOW US HERE

FacetWP Color Add-On

VERSION
UPDATED
LICENSE GPL
DEVELOPER FacetWP
SOFTWARE WordPress
TYPE

Original price was: €59.00.Current price is: €1.83.

All the plugins and themes on gplplugins.site are released under the GPL (General Public License) license. It is 100% legal for us to redistribute the products to you. It is completely safe, legal, and legit.

This is the original file from the developer, not modified, not nulled and not malware.

FOR DAILY UPDATES & SUPPORT
FOLLOW US HERE

RELATED PRODUCTS

Shopping cart
Shop
0 items Cart
My account