Created
September 25, 2017 12:48
-
-
Save rashmimalpande/67f6f0d811a74d44e281b065845796e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function add_custom_html() { | |
global $post; | |
$product_id = $post->ID; | |
$ids = array( 780, 767, 643); | |
$tags = get_the_terms( $product_id, 'product_tag' ); | |
if( empty( $tags ) ){ | |
return; | |
} | |
$content = " | |
<table> | |
<tr> | |
<th></th> | |
<th>Small</th> | |
<th>Medium</th> | |
<th>Large</th> | |
</tr> | |
<tr> | |
<td>USA</td> | |
<td>2-4</td> | |
<td>6-8</td> | |
<td>9-12</td> | |
</tr> | |
<tr> | |
<td>UK</td> | |
<td>4-6</td> | |
<td>8-10</td> | |
<td>12-14</td> | |
</tr> | |
<tr> | |
<td>India</td> | |
<td>2-4</td> | |
<td>6-8</td> | |
<td>10-12</td> | |
</tr> | |
</table> | |
"; | |
foreach( $tags as $tag ){ | |
if( 'men' == $tag->slug ) { | |
echo $content; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment