Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Woocommerce] Usunięcie "cena:" lista produktów
KotWButach
post
Post #1





Grupa: Zarejestrowani
Postów: 361
Pomógł: 10
Dołączył: 8.02.2012

Ostrzeżenie: (0%)
-----


Witam serdecznie,

cały dzień szukam jak usunąć na liście produktów napis "cena:" który znajduje się zaraz przed ceną.

[obrazek]
Tytuł produktu
cena: 965,00 zł

a chciałbym

[obrazek]
Tytuł produktu
965,00 zł

bez użycia JS. Jedyne co udało mi się osiągnąć to wyłączenie całej ceny bo w loop-price nie ma żadnej zmiennej odpowiedzialnej za napis cena. (IMG:style_emoticons/default/sad.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
KotWButach
post
Post #2





Grupa: Zarejestrowani
Postów: 361
Pomógł: 10
Dołączył: 8.02.2012

Ostrzeżenie: (0%)
-----


Zmarnowałem na to cały dzień i nie znalazłem...

Sprawe rozwiązałem chyba w jeden z mniej optymalnych sposobów ale działa
ob_start();

  1. <?php
  2. /**
  3.  * Loop Price
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/loop/price.php.
  6.  *
  7.  * HOWEVER, on occasion WooCommerce will need to update template files and you
  8.  * (the theme developer) will need to copy the new files to your theme to
  9.  * maintain compatibility. We try to do this as little as possible, but it does
  10.  * happen. When this occurs the version of the template file will be bumped and
  11.  * the readme will list any important changes.
  12.  *
  13.  * @see <a href="https://docs.woocommerce.com/document/template-structure/" target="_blank">https://docs.woocommerce.com/document/template-structure/</a>
  14.  * @author WooThemes
  15.  * @package WooCommerce/Templates
  16.  * @version 1.6.4
  17.  */
  18. if (!defined('ABSPATH')) {
  19. exit; // Exit if accessed directly
  20. }
  21.  
  22. global $product;
  23. ?>
  24.  
  25. <?php
  26. $product->get_price_html();
  27. $out1 = ob_get_contents();
  28. $removePrice = str_replace('cena: ', '', $out1);
  29. ?>
  30.  
  31. <?php if ($price_html = $removePrice) : ?>
  32. <span class="price"><?php echo $price_html; ?></span>
  33. <?php endif; ?>
  34.  
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.08.2026 - 19:43