Exemplo n.º 1
0
<?php

// calls the search form
thematic_search_form();
function thematic_access()
{
    global $my_shortname;
    $searchasli = stripslashes(get_option($my_shortname . '_searchasli'));
    // remove the fugly div; this has gone f00king bananas; it is supposed to add search to navigation li item. once upon at time it did work but has gone nuts
    // have a way to add search to access as li (todo)
    $findPatterns = array();
    $replacePatterns = array();
    $findPatterns[] = '#^\\<(div)([^>]*)\\>#';
    $findPatterns[] = '#\\<([/]*)(div)\\>$#';
    $replacePatterns[] = '';
    $replacePatterns[] = '';
    if ($searchasli == 'true') {
        $findPatterns[] = '#(\\<\\/ul\\>$)#';
        $replacePatterns[] = '<li class="search">' . thematic_search_form(false) . '</li></ul>';
    }
    $access = preg_replace($findPatterns, $replacePatterns, trim(wp_nav_menu(array('primary-menu', 'container_class' => '', 'menu_class' => '', 'echo' => false))), 1);
    ?>
	<nav id="access" role="navigation">
		<a href="#content" class="skip-link" title="<?php 
    _e('Skip navigation to the content', 'thematic');
    ?>
"><?php 
    _e('Skip to content', 'thematic');
    ?>
</a> 
		<?php 
    if (function_exists('wpmp_switcher_link')) {
        echo str_replace('<a ', '<a class="switch-mobile"', wpmp_switcher_link('mobile', 'mobile'));
    }
    echo $access;
    ?>
	</nav><!-- #access -->
<?php 
}
function thematic_access()
{
    global $my_shortname;
    $searchasli = stripslashes(get_option($my_shortname . '_searchasli'));
    // remove the fugly div
    $access = preg_replace('#<([/]*)(div)([^>]*)>#', '', wp_nav_menu(array('primary-menu', 'container_class' => '', 'menu_class' => '', 'echo' => false)), 1);
    // have a way to add search to access as li (todo)
    if ($searchasli == 'true') {
        $access = preg_replace('#(?![^\\s]+)(<\\/ul>)#', '<li>' . thematic_search_form(false) . '</li></ul>', trim($access), 1);
    }
    ?>
	<nav id="access">
		<a href="#content" class="skip-link" title="<?php 
    _e('Skip navigation to the content', 'thematic');
    ?>
"><?php 
    _e('Skip to content', 'thematic');
    ?>
</a>
		<?php 
    echo $access;
    ?>
	</nav><!-- #access -->
<?php 
}