• Resolved max143

    (@max143)


    I want get label of products in function that build custom template part, e.g

    
    function my_featured() {
      <div class="product">
         <img src="<?php echo $product_thumbnail[0];?>" alt="">
        <div class="prod_title"><?php the_title();?></div>
        <div class="price"><?php echo $product->get_price_html(); ?></div>
        <div class="label"></div>
      </div>
    }
    

    What must be in <div class="label"></div> to get label?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Dmytro Holovnia

    (@dholovnia)

    Hello,

    You need to create a folder in your child-theme called “woocommerce-products_label” and copy there file label.php from plugin’s templates folder.

    You can edit copy as you need. And there you can edit custom code/styles/etc.

    Regards,
    Dima

    Thread Starter max143

    (@max143)

    I dont want edit template of label, I just want get label https://prntscr.com/k8lz46 in that place of my template that I need.

    Thread Starter max143

    (@max143)

    Дима, если я правильно понял, Вы русскоговорящий? На русском будет проще объяснить. У меня есть кастомный вывод списка товаров, то есть не средствами woocommerce, а каждый элемент собираю вручную. Так вот, я хотел бы вывести этот label в этом же куске шаблона, могу ли я получить это типа так $product->get_label(30), есть ли подобная функция в Вашем плагине? Заранее благодарю за помощь.

    Plugin Author Dmytro Holovnia

    (@dholovnia)

    1. Вам надо ещё подучить WP для того чтобы такое делать. Суть не в коде, а в подходе. В WP всё делается через хуки

    2. do_action( 'lgv_advanced_after_img' ); там где вам надо вывести лейбл

    Thread Starter max143

    (@max143)

    я знаю, что такое хуки, но я не знал о Вашем lgv_advanced_after_img.
    спасибо.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom label output’ is closed to new replies.