如何在functions.asp中执行do_action

时间:2015-01-15 18:58:13

标签: php wordpress wordpress-theming

关于我的wordpress主题functions.asp文件,我有一个简单的问题。

我有以下功能,可以为网站构建主导航菜单。在倒数第二行我有一个php do_action但它不起作用?谁能告诉我如何让它在函数中运行?

function alanbrandt_nav()
{
    wp_nav_menu(
    array(
        'theme_location'  => 'header-menu',
        'menu'            => '', 
        'container'       => 'div', 
        'container_class' => 'menu-{menu slug}-container', 
        'container_id'    => '',
        'menu_class'      => 'menu', 
        'menu_id'         => '',
        'echo'            => true,
        'fallback_cb'     => 'wp_page_menu',
        'before'          => '',
        'after'           => '',
        'link_before'     => '',
        'link_after'      => '',
        'items_wrap'      => '<ul>%3$s',
        'depth'           => 0,
        'walker'          => ''
        )
    );
    echo "<li class='last'><form role='search' method='get' id='searchform' action='";
    echo "http://alanbrandt.com' class='' >";
    echo "<fieldset>";
    echo "<input type='text' value='' name='s' id='s' placeholder='Search' />";
    echo "<input type='submit' id='searchsubmit' value='Search' />";
        echo "</fieldset>";
    echo "</form></li></ul>";
    echo "<div id='language’>"do_action('zwt_lang_switcher', 'horizontal')"</div>";                            
        echo "<div class='cf'></div>";

}

希望有人可以提供帮助!

谢谢!

1 个答案:

答案 0 :(得分:1)

echo "<div id='language’>" . do_action('zwt_lang_switcher', 'horizontal') . "</div>";                            

试试吧。你忘了连接运算符了。 :)

干杯! = C =