PHP调用生成一个UL。我不知道';I don’我不知道如何把三个li元素加入到那个UL中

PHP调用生成一个UL。我不知道';I don’我不知道如何把三个li元素加入到那个UL中,php,html-lists,Php,Html Lists,我正试图将社交媒体图标与WP菜单放在页面的同一行。一个PHP调用调用菜单,另一个调用图标。这意味着它们是独立的ULs。我如何让他们在同一个UL,使他们出现在我的页面上的同一行?这是代码:该页面的链接是www.trailtrainer.net <!-- The Navigation Menu --> <ul id="navi"> <h1 id="fittext3"><a href="<?php echo home_url(); ?>/">

我正试图将社交媒体图标与WP菜单放在页面的同一行。一个PHP调用调用菜单,另一个调用图标。这意味着它们是独立的ULs。我如何让他们在同一个UL,使他们出现在我的页面上的同一行?这是代码:该页面的链接是www.trailtrainer.net

<!-- The Navigation Menu -->
<ul id="navi">
<h1 id="fittext3"><a href="<?php echo home_url(); ?>/"><?php bloginfo('name'); ?></a><i><?php bloginfo('description');?></i></h1>
<ul id="fittext1" style="width: 100%;><?php if ( has_nav_menu( 'bar' ) ) :  wp_nav_menu( array( 'theme_location' => 'bar', 'depth' => 2 ) ); else : ?>
<?php wp_list_pages( 'title_li=&depth=2' ); ?>
    <?php endif; ?>
<?php if ( ( get_theme_mod('facebook_setting') != 'The url link goes in here.' ) && ( get_theme_mod('facebook_setting') != '' ) ) : ?><li><a href="<?php echo get_theme_mod('facebook_setting') ;?>" class="icon-facebook-rect"></a></li><?php endif; ?>
<?php if ( ( get_theme_mod('twitter_setting') != 'The url link goes in here.' ) && ( get_theme_mod('twitter_setting') != '' ) ) : ?><li><a href="<?php echo get_theme_mod('twitter_setting') ;?>" class="icon-twitter"></a></li><?php endif; ?>
<?php if ( ( get_theme_mod('youtube_setting') != 'The url link goes in here.' ) && ( get_theme_mod('youtube_setting') != '' ) ) : ?><li><a href="<?php echo     get_theme_mod('youtube_setting') ;?>" class="icon-youtube"></a></li><?php endif; ?>
<?php endif; ?>

<!-- End Navigation Menu -->


    未经测试,快速且肮脏,但我认为这应该是您所寻找的大致范围:

    <?
    function settingExists($name)
    {
        return ((get_theme_mod($name) != 'The url link goes in here') && get_theme_mod($name) != ''));
    }
    
    if(settingExists('facebook_setting') || settingExists('twitter_setting') || settingExists('youtube_setting'))
    {
        echo("<li>");
        if(settingExists('facebook_setting')){
            echo("<a href="get_theme_mod('facebook_setting')>" class="icon-facebook-rect"></a><)";
        }
        if(settingExists('twitter_setting')){
            echo("<a href="get_theme_mod('twitter_setting')>" class="icon-facebook-rect"></a><)";
        }
    
        if(settingExists('youtube_setting')){
            echo("<a href="get_theme_mod('youtube_setting')>" class="icon-facebook-rect"></a><)";
        }
        echo("</li>");
    
    }
    ?>
    

    谢谢你的帮助。对不起,当涉及到代码时,我不善于理解字里行间的意思。您是否介意向我展示一下,如果将这段代码放入我的.php文件中,它会是什么样子?我在原来的帖子中添加了更多的代码以了解更多细节。