Home Forums WoodMart support forum Brand image on product archive

Brand image on product archive

Viewing 3 posts - 31 through 33 (of 33 total)
  • Author
    Posts
  • #39764

    Artem Temos
    Keymaster

    Great, we are glad that it works for you.

    #418526

    kinigakos
    Participant

    Hello, I’ve been trying to use this code but it gives me an error.

    “( ! ) Warning: ltrim() expects parameter 1 to be string, array given in …”

    The problem seems to be that get_term_meta( $brands->term_id returns an array.

    Any ideas?

    PS. The option from the theme options “Shop->Attribute swatches->Grid swatch attribute to display” is not an otpion for me because I’m using it for something else so I need to add this custom code that is mentioned in this thread.

    • This reply was modified 1 year, 6 months ago by kinigakos.
    #418528

    kinigakos
    Participant

    EDIT

    I’ve managed to solve this.
    $image = get_term_meta( $brands->term_id, 'image', true ); returns the brand image link and the ID like https:// domain.com/image.jpg,11123 so I’ve used the following

    $imagestring = implode(',', $image);
    $imagestring = preg_replace('/^([^,]*).*$/', '$1', $imagestring);
    • This reply was modified 1 year, 6 months ago by kinigakos.
    • This reply was modified 1 year, 6 months ago by kinigakos.
Viewing 3 posts - 31 through 33 (of 33 total)