从此跟进: 将特定的类/ID应用于菜单上的当前页面(PHP)
这是我正在使用的代码:
<div id="bottoni" style="float:right;margin-top:30px;margin-right:30px">
<?php
// funzione per ottenere la class 'current' per la pagina che si sta visitando
function get_current($name) {
if (strpos($_SERVER['REQUEST_URI'], $name) !== false)
echo 'id="current"';
}
?>
<a <?php get_current('biografia') ?> href="<?php echo esc_url( home_url( '/' ) ); ?>biografia/"><img style="width:120px;margin-right:25px" src="http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_robertocavosi.jpg"></a>
<a <?php get_current('attore') ?> <?php get_current('regista') ?> <?php get_current('autore') ?> <?php get_current('riconoscimenti') ?> <?php get_current('pubblicazioni') ?> <?php get_current('insegnamento') ?> id="tooltipclick"><img style="width:120px;margin-right:25px;cursor:pointer" src="http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_curriculum.jpg"></a>
<a <?php get_current('gallery') ?> href="<?php echo esc_url( home_url( '/' ) ); ?>gallery/"><img style="width:120px;margin-right:25px;border:0" src="http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_gallery.jpg"></a>
<a <?php get_current('itinera') ?> href="<?php echo esc_url( home_url( '/' ) ); ?>itinera/"><img style="width:120px;margin-right:25px;border:0" src="http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_itinera.jpg"></a>
<a <?php get_current('contatti') ?> href="<?php echo esc_url( home_url( '/' ) ); ?>contatti/"><img style="width:120px;border:0" src="http://robertocavosi.com/beta/wp-content/themes/robertocavosi/images/bottone_contatti.jpg"></a>
</div>
我想在一个“电话”中指定所有这些:
<?php get_current('attore') ?> <?php get_current('regista') ?> <?php get_current('autore') ?> <?php get_current('riconoscimenti') ?> <?php get_current('pubblicazioni') ?> <?php get_current('insegnamento') ?>
我试过:
<?php get_current('attore', 'regista', 'autore', 'riconoscimenti', 'pubblicazioni', 'insegnamento') ?>
但它不起作用...