admin管理员组

文章数量:1123567

I want to duplicate my homepage then call the pages A. page b & c. - So that I can edit just a few things on all the pages. I already have some pages but I can't get bits exactly the same.I copied parts of style.css to header.php in the parent theme but didn't work - maybe 'cause it calls to the main page at the end - If I delete the div main site at the end of the header.php I lose most of what I want. Here is the code

<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width">
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="">
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    <!--[if lt IE 9]>
    <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
    <![endif]-->
    <?php wp_head(); ?>
<style>
@import url(+Text:300,400,500,700);

body {
    background-image:url(); ----- this pic is not the same px as homepage!
    background-position: 70px 0px;background-size: cover;background-attachment:scroll;margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;font-family: 'Crimson+Text', serif, inherit;font-variant:small-caps;font-size:16px;}
.style1 {  ----up to style12----}#tst4 {position: absolute; top:105px; left:70px;}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:0;">
  <tr bgcolor="#1a1e2a">
    <td align="left" valign="top" bgcolor="#1a1e2a"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
      <td><table border="0" cellspacing="0" cellpadding="0">
        <tr>
         <td><table border="0" cellspacing="0" bgcolor="#1a1e2a" cellpadding="0">
                  <tr>
                    <td width="20px" ></td>
                    <td><span class="style1">My homepage title is three words</span></td>
                    <td><span class="style3"> I wish the third word to go here so it is different on every page - </span></td>
                  </tr>               
              </table></td>
            </tr>
            <tr>
              <td><div id="tst4";><img src=".png" alt="header_underline" width="200" height="17" /></div></td>
            </tr>
          </table></td>          
          <td width="50%" align="right" valign="right"><div bgcolor="646565" align="right"> 
            <table width="50%" border="5" align="right" cellpadding="0" cellspacing="0"> 
              <tr>
                 <td width="100%" class="style7" style="border-bottom-right-radius:0px;border-bottom-left-radius:0px;"><div align="center"><?php  if ( function_exists('cn_social_icon') ) echo cn_social_icon(); ?></div></td>
                <tr>
                <tr>
                <td class="style10" > <div bgcolor="646565" align="right">like&nbsp;us</div></td>
              </tr>
            </table>
          </div></td>
        </tr>
      </table>
      <div align="right"></div></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td class="style6"><table border="0" cellpadding="0" cellspacing="0" bordercolor="#0d8181" bgcolor="#1a1e2a" style="border-bottom-right-radius:5px;">
          </tr>
              <td><p></p></td>
          </tr>
</style>
</head>
<div id="main" class="site-main"> 

I want to duplicate my homepage then call the pages A. page b & c. - So that I can edit just a few things on all the pages. I already have some pages but I can't get bits exactly the same.I copied parts of style.css to header.php in the parent theme but didn't work - maybe 'cause it calls to the main page at the end - If I delete the div main site at the end of the header.php I lose most of what I want. Here is the code

<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width">
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11">
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    <!--[if lt IE 9]>
    <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
    <![endif]-->
    <?php wp_head(); ?>
<style>
@import url(http://fonts.googleapis.com/css?family=Crimson+Text:300,400,500,700);

body {
    background-image:url(http://Shot.jpeg); ----- this pic is not the same px as homepage!
    background-position: 70px 0px;background-size: cover;background-attachment:scroll;margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;font-family: 'Crimson+Text', serif, inherit;font-variant:small-caps;font-size:16px;}
.style1 {  ----up to style12----}#tst4 {position: absolute; top:105px; left:70px;}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:0;">
  <tr bgcolor="#1a1e2a">
    <td align="left" valign="top" bgcolor="#1a1e2a"><table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
      <td><table border="0" cellspacing="0" cellpadding="0">
        <tr>
         <td><table border="0" cellspacing="0" bgcolor="#1a1e2a" cellpadding="0">
                  <tr>
                    <td width="20px" ></td>
                    <td><span class="style1">My homepage title is three words</span></td>
                    <td><span class="style3"> I wish the third word to go here so it is different on every page - </span></td>
                  </tr>               
              </table></td>
            </tr>
            <tr>
              <td><div id="tst4";><img src="http://www.myhomepage.net/wp-content/uploads/2014/01/header_underline.png" alt="header_underline" width="200" height="17" /></div></td>
            </tr>
          </table></td>          
          <td width="50%" align="right" valign="right"><div bgcolor="646565" align="right"> 
            <table width="50%" border="5" align="right" cellpadding="0" cellspacing="0"> 
              <tr>
                 <td width="100%" class="style7" style="border-bottom-right-radius:0px;border-bottom-left-radius:0px;"><div align="center"><?php  if ( function_exists('cn_social_icon') ) echo cn_social_icon(); ?></div></td>
                <tr>
                <tr>
                <td class="style10" > <div bgcolor="646565" align="right">like&nbsp;us</div></td>
              </tr>
            </table>
          </div></td>
        </tr>
      </table>
      <div align="right"></div></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td class="style6"><table border="0" cellpadding="0" cellspacing="0" bordercolor="#0d8181" bgcolor="#1a1e2a" style="border-bottom-right-radius:5px;">
          </tr>
              <td><p></p></td>
          </tr>
</style>
</head>
<div id="main" class="site-main"> 
Share Improve this question edited Apr 17, 2014 at 10:36 Pieter Goosen 55.4k23 gold badges115 silver badges209 bronze badges asked Apr 17, 2014 at 10:09 monkeybmonkeyb 194 bronze badges 2
  • 2 Go and have a look at these pages on how to create page templates. I can't make head or tail from your code here. Page Templates and Pages and Creating Custom Page Templates – Pieter Goosen Commented Apr 17, 2014 at 10:57
  • Your question isn't clear. Is the following statement correct? You want to edit content in one place and you want the update/edit take place on all the three pages. Is it? – Shihab Commented Mar 22, 2020 at 13:41
Add a comment  | 

1 Answer 1

Reset to default 0

If you want your pages to look exactly like your home page, you could simply copy the code from index.php to page.php. You would then have to ensure that any content loop or the_content() was being used properly.

本文标签: I want to duplicate homepage for all my pages