Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active November 30, 2021 10:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save woogists/425310a576d329d1278ebed54d29bb93 to your computer and use it in GitHub Desktop.
Save woogists/425310a576d329d1278ebed54d29bb93 to your computer and use it in GitHub Desktop.
[Theming][Conditional Tags] Working example how you would display different content for different categories.
if ( is_product_category() ) {
if ( is_product_category( 'shirts' ) ) {
echo 'Hi! Take a look at our sweet tshirts below.';
} elseif ( is_product_category( 'games' ) ) {
echo 'Hi! Hungry for some gaming?';
} else {
echo 'Hi! Check our our products below.';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment