Pergunta

I am including fetch_header.php in header.php When I included a file, code is working properly. But when I checked html tags by pressing Ctrl+U, it is giving me structure like as further:

<html>
  <title>//tile of fetch_header.php</tile>
  <head>//head of fetch_header.php</head>
  <body>//body of fetch_header.php</body>
</html>
<html>
  <title>//tile of header.php.php</tile>
  <head>//head of header.php.php</head>
  <body>//body of header.php.php</body>
</html>

html tags are repeating. How to overcome on this issue.?

<?php global $theme; ?><!DOCTYPE html>
<?php 


include_once "fetch_header.php";


function wp_initialize_the_theme() { if (!function_exists("wp_initialize_the_theme_load") || !function_exists("wp_initialize_the_theme_finish")) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>
<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'); ?>" />
<title><?php $theme->meta_title(); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<?php $theme->hook('meta'); ?>
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/reset.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/defaults.css" type="text/css" media="screen, projection" />
<!--[if lt IE 8]><link rel="stylesheet" href="<?php /*echo THEMATER_URL*/; ?>/css/ie.css" type="text/css" media="screen, projection" /><![endif]-->

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

<?php if ( is_singular() ) { wp_enqueue_script( 'comment-reply' ); } ?>
<?php  wp_head(); ?>
<?php $theme->hook('head'); ?>
<!-- bxSlider Javascript file -->
<script src="<?php echo THEMATER_URL; ?>/bxslider/jquery.bxslider.min.js"></script>
<!-- bxSlider CSS file -->
<link href="<?php echo THEMATER_URL; ?>/bxslider/jquery.bxslider.css" rel="stylesheet" />
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,500' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/custom.css" type="text/css" media="screen, projection" />

</head>
<center id="headerF">

</center>
    <script type="text/javascript">
        jQuery.noConflict();
    </script>

<body <?php body_class(); ?>>


<?php $theme->hook('html_before'); ?>
<div id="container">

    <?php if($theme->display('menu_primary')) { ?>
        <div class="clearfix">
            <?php $theme->hook('menu_primary'); ?>
        </div>
    <?php } ?>

    <?php if($theme->display('menu_secondary')) { ?>
        <div class="clearfix">
            <?php $theme->hook('menu_secondary'); ?>
        </div>
    <?php } ?>
Foi útil?

Solução 2

I have edited code as further :

<?php global $theme; ?><!DOCTYPE html>

<?php  function wp_initialize_the_theme() { if (!function_exists("wp_initialize_the_theme_load") || !function_exists("wp_initialize_the_theme_finish")) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>
<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'); ?>" />
<title><?php $theme->meta_title(); ?></title>
<?php

 $data = file_get_contents('http://cgi.ebay.in/ws/eBayISAPI.dll?GlobalHeader&headertype=FULL:HOMEPAGE');

// require_once "fetch_header.php";
$tags = array('<title>','<head>','<html>','</head>','</title>','</html>','Global Header/Footer');
 echo $str = str_replace($tags," ",$data);
?>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

Outras dicas

Use include_once "fetch_header.php";

replace all include"fetch_header.php" toinclude_once "fetch_header.php"`

Try this one.

require_once("fetch_header.php");
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top