- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
December 7, 2023 at 10:25 am #8944David HoangKeymaster
I have resolve it.
<div class="EMP-100-TAW-Craciun-Produs-I"> <?php if ( get_the_ID() === 1744) { $product; $regular_price = esc_attr( $product->get_display_price() ); $discount = 10; $currency = esc_attr( get_woocommerce_currency() ); $new_price = $regular_price - ($regular_price * 0.10); echo 'Cumpără acest produs cu doar <span style=" font-size: 20px; color: red; ">'.$new_price.$currency.'</span> prin Cadoul TAW de Crăciun'; } ?> </div>
I want in pagination, category listings to hide a custom div using PHP code,
For one particular product I want my div below title to have display: none;I have this code but it apply to all products listings?
Any idea’s? Thanks!
<div class="EMP-100-TAW-Craciun-Produs-I"> <?php global $product; $regular_price = esc_attr( $product->get_display_price() ); $discount = 10; $currency = esc_attr( get_woocommerce_currency() ); $new_price = $regular_price - ($regular_price * 0.10); echo 'Cumpără acest produs cu doar <span style=" font-size: 20px; color: red; ">'.$new_price.$currency.'</span> prin Cadoul TAW de Crăciun'; ?> </div> <?php if ( get_the_ID() === 1744) { echo "<style>.EMP-100-TAW-Craciun-Produs-I { display: none; }</style>"; } else{ echo "<style>.EMP-100-TAW-Craciun-Produs-I { display: inherit; }</style>"; } ?>
December 7, 2023 at 11:10 am #8945David HoangKeymasterI would do the following:
<?php if(get_the_ID() == 1744) { ?> <div class="EMP-100-TAW-Craciun-Produs-I"> <!-- ... --> </div> <?php } ?>
like so I would get the whole
div
only if the ID is 1744 and i need nodisplay: none
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.