// shortcode voor Google Material Icons
// [gm_icon name="search" type="sharp" class="text-primary fs-4"][/gm_icon]
function wbmz_icon($atts, $content = null) {
  // Haal attributen op en stel standaardwaarden in
  $a = shortcode_atts([
    'name' => '',
    'type' => 'outlined',
    'class' => ''
  ], $atts);

  // Attributen
  $naam = $a['name'];
  $type = $a['type'];
  $class = $a['class'];
  $icon = '<span class="material-symbols-'.$type.' notranslate '.$class.'">'.$naam.' </span>';
  // Toon alleen de output op het frontend
  if(!is_admin()):
  return $icon;
  endif;
}
add_shortcode('gm_icon', 'wbmz_icon');
Geef een reactie 0