doureng6738 2016-07-25 15:12
浏览 42
已采纳

添加联系方式到header.php Wordpress

I'm trying to add some contact details to the right of the logo on this site.

At the moment it is displaying beneath the logo. I'd also like to change the font and colour to match the nav bar.

Here's the code for the header.php to show what I did to the site. I'm also aware that Laura (the owner) should be using a child theme but her husband built the site and has already done a lot of work without a child so building one for this one change seems redundant?

<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js" >
<!-- start -->
<head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="format-detection" content="telephone=no">

    <!-- set faviocn-->
    <?php 
    global $pmc_data; 
    $favicon = ''; 
    if(isset($pmc_data['favicon']))
        $favicon = $pmc_data['favicon'];
    if (empty($favicon)) { $favicon = get_template_directory_uri() .'/images/favicon.ico'; }    
    ?>

    <!-- set title of the page -->
    <title>
    <?php
    global $page, $paged;
    wp_title( '|', true, 'right' );
    bloginfo( 'name' );
    $site_description = get_bloginfo( 'description', 'display' );
    if ( $site_description && ( is_home() || is_front_page() ) )
        echo " | $site_description";
    if ( $paged >= 2 || $page >= 2 )
        echo ' | ' . sprintf( 'Page %s' , max( $paged, $page ) );
    ?>
    </title>

    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <link id="favicon" rel="icon"  type="image/png" href="<?php echo $pmc_data['favicon'] ?>">
    <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />

    <?php if ( is_singular() && get_option( 'thread_comments' ) ) {wp_enqueue_script( 'comment-reply' ); }?>

    <!-- add google analytics code -->
    <?php       
    if(isset($pmc_data['google_analytics'])) 
    echo pmc_stripText($pmc_data['google_analytics']); 
    ?>
    <?php wp_head();?>
</head>     
<!-- start body -->
<body <?php body_class(); ?>>
    <!-- start header -->
    <header>
        <div id="headerwrap" >
            <!-- fixed menu -->
            <div class="pagenav fixedmenu">
                <div class="holder-fixedmenu">
                    <div class="logo-fixedmenu">
                        <?php $logo = $pmc_data['logo']; ?>
                        <a href="<?php echo home_url(); ?>"><img src="<?php if ($logo != '') {?><?php echo $logo; ?><?php } else {?><?php get_template_directory_uri(); ?>/images/logo.png<?php }?>" alt="<?php bloginfo('name'); ?> - <?php bloginfo('description') ?>" ></a>
                    </div>
                    <div class="menu-fixedmenu">
                        <?php 
                        if ( has_nav_menu( 'scroll_menu' ) ) {
                             wp_nav_menu( array(
                             'container' =>false,
                             'container_class' => 'menu-scroll',
                             'theme_location' => 'scroll_menu',
                             'echo' => true,
                             'fallback_cb' => 'ideo_fallback_menu',
                             'before' => '',
                             'after' => '',
                             'link_before' => '',
                             'link_after' => '',
                             'depth' => 0,
                             'walker' => new description_walker())
                             ); 
                        }
                        ?>
                    </div>
                    <!-- respoonsive menu for scrool bar -->

                </div>
            </div>  
            <!-- top bar -->
            <div class="TopHolder">
                <?php pmc_showTop() ?>  
            </div>  
            <!-- logo and main menu -->
            <div id="header">   
                <div class = "header-inner">
                    <div class="header-social">
                        <?php pmc_socialLink() ?>
                    </div>
                    <div id="logo">
                        <?php $logo = $pmc_data['logo']; ?>
                        <a href="<?php echo home_url(); ?>"><img src="<?php if ($logo != '') {?><?php echo $logo; ?><?php } else {?><?php get_template_directory_uri(); ?>/images/logo.png<?php }?>" alt="<?php bloginfo('name'); ?> - <?php bloginfo('description') ?>" /></a>
                            <div id="contact">
                            <p>07939598489</p>      <p>laura@bristolbridalboutique.co.uk</p>
            </div>
                    </div>
                    <!-- respoonsive menu main-->
                    <div class="respMenu noscroll">
                        <div class="resp_menu_button"><i class="fa fa-list fa-2x"></i> Menu</div>
                        <?php 
                        if ( has_nav_menu( 'resp_menu' ) ) {
                            $menuParameters =  array(
                              'theme_location' => 'resp_menu', 
                              'walker'         => new Walker_Responsive_Menu(),
                              'echo'            => false,
                              'items_wrap'     => '<div class="event-type-selector-dropdown">%3$s</div>',
                            );
                            echo strip_tags(wp_nav_menu( $menuParameters ), '<a>,<br>,<div>,<i>' );
                        }?> 
                    </div>  

                <!-- main menu -->
                <div class="pagenav">
                    <?php 
                    if ( has_nav_menu( 'main-menu' ) ) {
                         wp_nav_menu( array(
                         'container' =>false,
                         'container_class' => 'menu-header',
                         'theme_location' => 'main-menu',
                         'echo' => true,
                         'fallback_cb' => 'ideo_fallback_menu',
                         'before' => '',
                         'after' => '',
                         'link_before' => '',
                         'link_after' => '',
                         'depth' => 0,
                         'walker' => new description_walker())
                         ); 
                    }
                    ?>

                </div>                  
            </div>  
        </div>          
    </header>           
  • 写回答

1条回答 默认 最新

  • duanmei1694 2016-07-25 15:18
    关注

    To get it on the right side you can use

    #contact{ float:right;}
    

    and to align it with the rest you can add

    margin-top:54px;
    

    for the font/color you can add

    font-family: "brioche-italic", georgia, "Helvetica Neue", Arial, Helvetica, Verdana, sans-serif !important;
    font-size: 17px;
    color: #94bfba !important;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题