Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为什么我的帖子标题取代了我的页面标题_Php_Wordpress - Fatal编程技术网

Php 为什么我的帖子标题取代了我的页面标题

Php 为什么我的帖子标题取代了我的页面标题,php,wordpress,Php,Wordpress,嗨,伙计们,我之前发布了一个问题,关于我的博客帖子如何在wordpress中不断取代我的页面标题 但我不明白我的问题是如何回答的,因为我没有php经验,所以我想我会在这里发布我的代码,这样如果有人可以锁定wordpress代码中的错误? 这是标题为“最新消息”的页面的代码 <?php /** * The template for displaying all pages. * * This is the template that displays all pages by

嗨,伙计们,我之前发布了一个问题,关于我的博客帖子如何在wordpress中不断取代我的页面标题 但我不明白我的问题是如何回答的,因为我没有php经验,所以我想我会在这里发布我的代码,这样如果有人可以锁定wordpress代码中的错误? 这是标题为“最新消息”的页面的代码

    <?php
/**
 * The template for displaying all pages.
 *
 * This is the template that displays all pages by default.
 * Please note that this is the wordpress construct of pages
 * and that other 'pages' on your wordpress site will use a
 * different template.
 *
 */
?>
<?php get_header(); ?>
<div class="page-heading">
    <h1 class="page-title"><?php the_title(); ?></h1>
    <div class="clear"></div>
</div>
<!--Start Page Content -->
<div class="page-content-container">
    <div class="page-content">
        <div class="grid_16 alpha">
            <div class="content-bar">           
                <?php if (have_posts()) : the_post(); ?>
                    <?php the_content(); ?>
                    <div class="clear"></div>
                    <?php wp_link_pages(array('before' => '<div class="page-link"><span>' . __('Pages:', 'black-bird') . '</span>', 'after' => '</div>')); ?>
                <?php endif; ?>

                <!--Start Comment box-->
                <?php comments_template(); ?>
                <!--End Comment box-->

            </div>
        </div>
        <div class="grid_8 omega">
            <!--Start Sidebar-->
            <?php get_sidebar(); ?>
            <!--End Sidebar-->
        </div> 
    </div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>

这段代码:

<h1 class="post_title single"

当你说“title”时,你是指
还是实际的
(大概是在
get_header()中设置的)
?在wordpress中添加txt时,会给你两个空白框,一个小框是标题所在的位置,然后是一个大框是内容所在的位置。因此,我关心的是标题还是内容所在的小框是标题框?这些都没有起作用,标题与帖子保持一致。你是否尝试过将其添加到header.php而不是你的p年龄?这应该是你的页面标题设置好的地方,因为我是php imaginate新手,我会在上面粘贴我的标题代码,如果你能在代码中看到为什么每个新帖子都会替换页面标题或标题,如果你能指出我应该添加的位置和内容,我会附和它
 <?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div id="main">
 *
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php language_attributes(); ?>>
    <head>
        <meta charset="<?php bloginfo('charset'); ?>" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  <title><?php wp_title(''); ?></title>
        <link rel="profile" href="http://gmpg.org/xfn/11" />
        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
        <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" />
        <?php wp_head(); ?> 
    </head>             
    <body <?php body_class(); ?> style="<?php if (blackbird_get_option('blackbird_bodybg') != '') { ?>background: fixed url(<?php echo blackbird_get_option('blackbird_bodybg'); ?>);<?php } else {
            ?> background: fixed url(<?php echo get_template_directory_uri(); ?>/images/bg.jpg); <?php } ?>" >
        <div class="main-container">
            <div class="container_24">
                <div class="grid_24">
                    <div class="header">
                        <div class="grid_16 alpha">
                            <div class="logo"> <a href="<?php echo home_url(); ?>"><img src="<?php if (blackbird_get_option('blackbird_logo') != '') { ?><?php echo blackbird_get_option('blackbird_logo'); ?><?php } else { ?><?php echo get_template_directory_uri(); ?>/images/logo.png<?php } ?>" alt="<?php bloginfo('name'); ?>" /></a></div>
                        </div>
                        <div class="grid_8 omega">
                            <div class="header-info">
                                <?php if (blackbird_get_option('blackbird_topright_cell') != '') { ?>
                                    <p class="cell"><img src="<?php echo get_template_directory_uri(); ?>/images/call-us.png"  class="call-us" />&nbsp; <?php echo stripslashes(blackbird_get_option('blackbird_topright_cell')); ?></p>
                                <?php } else { ?>
                                    <p class="cell"><img src="<?php echo get_template_directory_uri(); ?>/images/call-us.png"  class="call-us" />&nbsp;Call Us (111) 234 - 5678</p>
                                <?php } ?>
                                <?php if (blackbird_get_option('blackbird_topright_text') != '') { ?>
                                    <p><?php echo stripslashes(blackbird_get_option('blackbird_topright_text')); ?></p>
                                <?php } else { ?>
                                    <p><?php _e('21/B, London Campus, British Road, Birmingham, UK','black-bird'); ?></p>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <!--start Menu wrapper-->
                    <div class="menu_wrapper">
                        <div class="grid_18 alpha">
                            <div id="MainNav">
                                <a href="#" class="mobile_nav closed"><?php _e('Pages Navigation Menu','black-bird'); ?><span></span></a>
                                <?php blackbird_nav(); ?> 
                            </div></div>
                        <div class="grid_6 omega">
                            <div class="top-search">

                                <?php get_search_form(); ?>
                            </div>
                        </div>
                    </div>
                    <!--End Menu wrapper-->
                    <div class="clear"></div>
<h1 class="post_title single"
<h1><?php wp_title(''); ?></h1>
$parent_title = get_the_title($post->post_parent);
echo '<h1>' . $parent_title . '</h1>';