function link_to_unless_current($path, $name = null, $options = null, $block = null) { if (is_current_page($path)) { if ($block === null && is_callable($options) === true) { $block = $options; } if ($block === null && is_callable($name) === true) { $block = $name; } if ($name === null || is_callable($name) === true) { $name = url($path); } if ($block !== null) { return $block($name); } else { return $name; } } else { return link_to($path, $name, $options); } }
function link_to_unless_current($label, $urlOptions = array(), $htmlOptions = array()) { return link_to_unless(is_current_page($urlOptions), $label, $urlOptions, $htmlOptions); }
/** * Creates a link tag of the given +name+ using an URL created by the set of +options+, unless the current * request uri is the same as the link's, in which case only the name is returned (or the * given block is yielded, if one exists). This is useful for creating link bars where you don't want to link * to the page currently being viewed. */ function link_to_unless_current( $name, $options = array(), $html_options = array() ) { return link_to_unless( is_current_page( $options ), $name, $options, $html_options, func_get_args() ); }
if (!osc_is_static_page() && !osc_is_contact_page()) { echo 'class="current-menu-item"'; } ?> ><a href="<?php echo osc_base_url(); ?> "><?php _e('Advertises', 'seeker'); ?> </a></li> <?php while (osc_has_static_pages()) { ?> <li <?php if (is_current_page(osc_static_page_id())) { echo 'class="current-menu-item"'; } ?> ><a href="<?php echo osc_static_page_url(); ?> "><?php echo osc_static_page_title(); ?> </a></li> <?php } ?> <?php osc_reset_static_pages();