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 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法