Skip to content

Instantly share code, notes, and snippets.

@Oscar-Abad-Folgueira
Last active May 10, 2020 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oscar-Abad-Folgueira/e434664ca9c7d8dc3f9ad215964263b6 to your computer and use it in GitHub Desktop.
Save Oscar-Abad-Folgueira/e434664ca9c7d8dc3f9ad215964263b6 to your computer and use it in GitHub Desktop.
<?php
/**
* @snippet Comprobar si el post tiene asignado el término "action" de la taxonomía "hook-type"
* para asignar una clase css u otra.
* @author Oscar Abad Folgueira
* @author_url https://www.oscarabadfolgueira.com
* @snippet_url https://www.oscarabadfolgueira.com/comprobar-si-un-post-tiene-asignado-un-termino-de-una-taxonomia-en-wordpress/
*/
$hook_css_class = '';
if (has_term( 'action', 'hook-type' )) {
$hook_css_class = "is-action-hook";
} else {
$hook_css_class = "is-filter-hook";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment