Color link
-
Hi,
I’m generating the color palette on my page in the php like so:
<?php $i = 0; $max_iterations = 6; $colors = get_the_terms( $post_thumbnail_id, 'cpg_palette'); if ( $colors && !is_wp_error( $colors ) ) : $color_array = array(); foreach ( $colors as $color ) : if ($i < $max_iterations) : $color_array[$i] = $color->slug; $i++; endif; endforeach; endif; foreach ( $color_array as $color ) : ?> <a href="<?php echo esc_url( get_bloginfo( 'url' ) . '/color/' . $color) ?>" style="background: #<?php echo $color; ?>;"></a> <?php endforeach; ?>
I’m not sure how to code the URL for the color so that clicking on it would take the user to an archive page of the closest dominant color?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Color link’ is closed to new replies.