• Resolved Nu Ad Agency

    (@nuadagency)


    Good day folks,

    regarding the usage of WPC LV and WPC VS, I’m trying to work around both and actually use the custom swatch images set by WPC VS in WPC LV.

    I’ve noticed there is a solution provided by Developer when it comes to using custom-set colours, here and here.

    Would it be possible to use image ($wpcvs_image) or any other available field VS field in LV boxes?
    I’d be really grateful if you’d head me in the right direction, as I’m having no luck so far with actually rendering the image field from VS in LV.

    Regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Nu Ad Agency

    (@nuadagency)

    Update: turns out my solution for this was working all along. I just missed checking the required option in the WPCVS plugin configuration [Show images].

    To anyone interested in this, here’s the code (might need some tuning):

    add_filter( 'wpclv_term_image', 'wpclv_term_photo', 99, 2 );
    function wpclv_term_photo( $term_image, $term ) {
        $image = get_term_meta( $term->term_id, 'wpcvs_image', true ) ?: '';
       
        if ( ! empty( $image ) ) {
            return '<img src="' . esc_url( wp_get_attachment_thumb_url( $image ) ) . '"/>';
        }
    
        return $term_image;
    }
    Plugin Author WPClever

    (@wpclever)

    Hi,

    I’m so sorry for the late reply and thanks for the snippet. It works!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom image instead of a product photo’ is closed to new replies.