WordPress Theme “ERROR: The theme defines itself a

2019-05-08 03:09发布

In my WordPress Website's Themes Area I am getting strange message - "ERROR: The theme defines itself as its parent theme. Please check the Template header." enter image description here I Cannot Figure out what is Wrong. Please help me.

The header.php files code is given below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title><?php wp_title( '|', true, 'right' ); ?></title>
  <?php wp_head(); ?>
  <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"/>
  <link rel="icon" type="image/png" href="<?php bloginfo('stylesheet_directory'); ?>/Images/favicon.gif" />
  <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/Font/font-awesome-4.0.3/css/font-awesome.min.css">
</head>
<body class="custom-background">
  <div id="wrap">
    <div id="header">
      <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
            <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="fortuneshop9999" />
      </a>
    </div>
    <!--Google Translator-->
    <div id="google_translate_element">
            </div>
            <script type="text/javascript">
                function googleTranslateElementInit() {
                    new google.translate.TranslateElement({ pageLanguage: 'nl', layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element');
                }
            </script>
            <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    <!--End-->
    <div id="nav">
      <div>
        <ul>
          <?php wp_nav_menu( array( 'theme_location' => 'main-menu', 'container' => '', 'menu_class' => 'mainMenu' ) );?>
        </ul>
      </div>
    </div>
    <div id="subnav">
      <ul>
        <li class="menu-facebook">
          <a href="https://www.facebook.com" target="_blank">Facebook</a>
        </li>
        <li class="menu-twitter">
          <a href="http://www.twitter.com" target="_blank">Twitter</a>
        </li>
        <li class="menu-email">
          <a href="mailto:fortuneshop9999@gmail.com" target="_blank">Email</a>
        </li>
        <li class="menu-pinterest">
          <a href="http://www.pinterest.com" target="_blank">Pinterest</a>
        </li>
      </ul>
      <form class="search" method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
        <input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" placeholder="Search here"/>
        <input type="submit" id="submit" value=""/>
      </form>
    </div>

The style.css code is:

    /*
 Theme Name:   Yogi7
 Theme URI:    http://www.myotcworld.com/website-package.aspx
 Author:       Yogi
 Author URI:   http://www.myotcworld.com/website-package.aspx
 Template:     yogi7
 Version:      1.0.0
*/
body.custom-background {
    background-attachment: scroll;
    background: url("Images/seamless-stone-background.jpg" ); /*background:#FDE6E0;*/
    background-position: left top;
    background-repeat: repeat;
}

body {
    background: none repeat scroll 0 0 #FFFFFF;
    color: #4A4A4A;
    font-family: "Times New Roman",Times,serif;
    font-size: 14px;
    margin: 0 auto 30px;
    padding: 0;
}

#header {
    width: 960px;
    height: 285px;
    background: url("Images/header.png") no-repeat;
}
....

标签: php wordpress
3条回答
相关推荐>>
2楼-- · 2019-05-08 03:48

You need to check on style.css file there its defined if a theme is going to be parent or child theme,

/* Theme Name: Twenty Fourteen Child Template: twentyfourteen */

see if theme name and template once check!

查看更多
戒情不戒烟
3楼-- · 2019-05-08 03:53

I removed the Template: yogi7 from the top of my styles.css file of the theme. And this solved the problem.

This is how the styles.css look now.

/*
Theme Name:   Yogi7
Theme URI:    http://www.myotcworld.com/website-package.aspx
Author:       Yogi
Author URI:   http://www.myotcworld.com/website-package.aspx
Version:      1.0.0
*/
body.custom-background {
    background-attachment: scroll;
    background: url("Images/seamless-stone-background.jpg" ); /*background:#FDE6E0;*/
    background-position: left top;
    background-repeat: repeat;
}

body {
    background: none repeat scroll 0 0 #FFFFFF;
    color: #4A4A4A;
    font-family: "Times New Roman",Times,serif;
    font-size: 14px;
    margin: 0 auto 30px;
    padding: 0;
}
......

Hope this helps others.

查看更多
来,给爷笑一个
4楼-- · 2019-05-08 03:55
/*
  Theme Name:   Yogi7 Child
  Theme URI:    http://www.myotcworld.com/website-package.aspx
  Description:  Yogi Child Theme
  Author:       Yogi
  Author URI:   http://example.com
  Template:     <REPLACE WITH YOUR DIRECTORY NAME OF THE PARENT THEME>
  Version:      1.0.0
  License:      GNU General Public License v2 or later
  License URI:  http://www.gnu.org/licenses/gpl-2.0.html
  Text Domain:  yogi-child
*/

The Template line corresponds to the directory name of the parent theme. The parent theme in example case is the Twenty Fifteen theme, so the Template will be twentyfifteen. You may be working with a different theme, so adjust accordingly.

Note: Replace Template with your directory name of the parent theme.

More you can read form official docs Codex Wordpress.

查看更多
登录 后发表回答