正在移动php的位置the_title


Moving location of php the_title

我正在尝试将包含页面标题的内容页面区域设置为全宽,这样我就可以将图像放回那里,类似于以下内容:http://www.nielsen.com/us/en/newswire.html

我曾尝试在page.php上将页面标题div移到容器上方,但它最终总是回到容器中。

以下是我希望在我的网站上移动的内容的示例:http://www.zachkeller.net/cp_site/?page_id=93

这是我的页面。php代码:

<?php get_header(); ?>
            <!-- If there is no gallery, just grab the featured image -->
            <?php if ( has_post_thumbnail() ) { ?>
              <a class="featured-image" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'okay' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_post_thumbnail( 'large-image' ); ?></a>
            <?php } ?>
            <div class="container-wrap">
                <div class="container">
                    <div class="content">
                        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                            <div class="blog-post clearfix">
                                <div class="blog-inside">
                                    <div class="page-title">
                                        <h1><?php the_title(); ?></h1>
                                    </div>
                                    <?php the_content(); ?>
                                </div><!-- blog inside -->
                            </div><!-- blog post -->
                        <?php endwhile; ?>
                        <?php endif; ?>
                    </div><!-- content -->
                    <?php get_sidebar(); ?>
                </div><!-- container -->
            </div><!-- container wrap -->
<?php get_footer(); ?>

您需要使用echo get_title();而不是_title。这样它就会输出到你想要的地方。_title会自动输出自己。get_title是您手动回显的值。

请务必检查您正在使用的页面模板。在wordpress中,一个很好的线索是检查body类,它通常包括"page-template-full-width-php"或类似的内容,告诉您要编辑哪个模板。