2016-04-06 9 views
0

上まで表示されている:ここコンタクトフォーム7は、以下に示すように、私のコンタクトフォームは私のワードプレスヘッダ上まで表示されているいくつかの理由ヘッダ

enter image description here

は私のコードである:

<?php 

    /** 
* Template Name: Contact Us 
* 
* @package WordPress 
* @subpackage Creativeforces 
* @since Creativeforces Group 1.0 
*/ 

?> 
<head> 
    <meta charset="utf-8"> 
    <title>Creative Forces | Contact Us</title> 
    <link rel="stylesheet" type="text/css" href="/wp-content/themes/creativeforces/css/contact.css"> 
    <link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700' rel='stylesheet' type='text/css'> 
</head> 


<header> 
     <?php while (have_posts()) : the_post() ?> 
      <?php the_content(); ?> 
     <?php endwhile; ?> 
     <?php get_sidebar(); ?> 
</header> 

    <?php get_header(); ?> 



    <?php get_footer(); ?> 

と私はショートコードを持っています:

[contact-form-7 id="131" title="Contact form 1"] 

ここにheader.php IDが必要です:

<?php 
/** 
* The template for displaying the header 
* 
* Displays all of the head element and everything up until the "site-content" div. 
* 
* @package WordPress 
* @subpackage Creativeforces 
* @since Creativeforces 1.0 
*/ 

?> 
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 
<head profile="http://gmpg.org/xfn/11"> 


    <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> 

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" /> 

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> 
    <script type="text/javascript" src="https://js.stripe.com/v2/"></script> 


    <?php wp_head(); ?> 

    <link rel="alternate" type="application/rss+xml" href="<?php bloginfo('rss2_url'); ?>" title="<?php printf(__('%s latest posts', 'your-theme'), wp_specialchars(get_bloginfo('name'), 1)); ?>" /> 
    <link rel="alternate" type="application/rss+xml" href="<?php bloginfo('comments_rss2_url') ?>" title="<?php printf(__('%s latest comments', 'your-theme'), wp_specialchars(get_bloginfo('name'), 1)); ?>" /> 
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 

</head> 

<body data-spy="scroll" data-target=".navbar"> 


<div class="black-line"></div> 


      <!-- LOGO --> 
      <?php if (get_theme_mod('themeslug_logo')) : ?> 
    <div class='site-logo'> 
     <a href='<?php echo esc_url(home_url('/')); ?>' title='<?php echo esc_attr(get_bloginfo('name', 'display')); ?>' rel='home'><img src='<?php echo esc_url(get_theme_mod('themeslug_logo')); ?>' alt='<?php echo esc_attr(get_bloginfo('name', 'display')); ?>'></a> 
    </div> 
<?php else : ?> 

    <!-- Displayes blog title and description --> 
    <hgroup> 
     <h1 class='site-title'><a href='<?php echo esc_url(home_url('/')); ?>' title='<?php echo esc_attr(get_bloginfo('name', 'display')); ?>' rel='home'><?php bloginfo('name'); ?></a></h1> 
     <h2 class='site-description'><?php bloginfo('description'); ?></h2> 
    </hgroup> 
<?php endif; ?> 

       <!-- Top-Nav-Menu --> 
<div id="menu" class="navbar text-center"> 

    <?php wp_nav_menu(array('sort_column' => 'menu_order', 'container_class' => 'menu-header', 'container' => 'nav', 'theme_location' => 'header-menu', 'walker' => new wp_bootstrap_navwalker())); ?> 


</div> 

助けていただければ幸いです!

答えて

0

the_content()の後にwp_header()を配置しました。 タグの横にある必要があります。あなたは、ヘッダ部内のコンテンツ/サイドバーを追加している

<?php 

    /** 
* Template Name: Contact Us 
* 
* @package WordPress 
* @subpackage Creativeforces 
* @since Creativeforces Group 1.0 
*/ 

?> 
<head> 
    <meta charset="utf-8"> 
    <title>Creative Forces | Contact Us</title> 
    <link rel="stylesheet" type="text/css" href="/wp-content/themes/creativeforces/css/contact.css"> 
    <link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700' rel='stylesheet' type='text/css'> 
</head> 

<body> 

<header> 
     <?php get_header(); ?> 
</header> 

    <?php while (have_posts()) : the_post() ?> 
      <?php the_content(); ?> 
     <?php endwhile; ?> 
     <?php get_sidebar(); ?> 


<footer> 
    <?php get_footer(); ?> 
</footer> 

0

と -

一般的にそれはようである - - ヘッダ - コンテンツ - ここにフッター

は修正後のコードですその後、このヘッダーが追加されているため、連絡先フォーム7がヘッダーの上に表示されます。

この

<header> 
     <?php get_header(); ?> 
    </header> 
    <div class="contentdiv"> 
    <?php while (have_posts()) : the_post() ?> 
    <?php the_content(); ?> 
    <?php endwhile; ?> 
    <?php get_sidebar(); ?> 
    </div> 
のようにしてみてください
関連する問題