如何在默认帖子页面中设置全宽页面布局?

时间:2013-05-08 作者:Smart Shovon

我想设置我的网站,这样当我去任何帖子时,它应该显示全宽页面。这个主题已经有一个全宽页面,但我希望它显示在默认宽度页面中。我如何才能做到这一点?我的网站链接是-http://techjagot.com

代码在单个中。php是:-

<?php get_header(); ?>
<?php
          setPostViews(get_the_ID());
?>

    <?php
    global $wp_query;
    $postid = $wp_query->post->ID;
    if ( get_post_meta( $postid, \'post_featpages\', true ) == "Yes" ) { ?>
        <?php include (TEMPLATEPATH . \'/featured-pages.php\'); ?>
    <?php } ?>

    <?php if ( get_post_meta( $postid, \'post_featcontent\', true ) == "Full Width Featured Content Slider"  ) { ?>
        <?php include (TEMPLATEPATH . \'/featured-wide.php\'); ?>
    <?php } ?>

    <div id="page" class="clearfix">

        <div id="contentleft">

            <?php if ( get_post_meta( $postid, \'post_featcontent\', true ) == "Narrow Width Featured Content Slider" ) { ?>
                <?php include (TEMPLATEPATH . \'/featured-narrow.php\'); ?>
            <?php } ?>

            <?php if ( get_post_meta( $postid, \'post_featgalleries\', true ) == "Yes" ) { ?>
                <?php include (TEMPLATEPATH . \'/featured-galleries.php\'); ?>
            <?php } ?>

            <?php if ( get_post_meta( $postid, \'post_featvideo\', true ) == "Yes" ) { ?>
                <?php include (TEMPLATEPATH . \'/featured-vids.php\'); ?>
            <?php } ?>

            <div id="content" class="maincontent">

                <?php if ( function_exists(\'yoast_breadcrumb\') ) { yoast_breadcrumb(\'<p id="breadcrumbs">\',\'</p>\'); } ?>

                <?php include (TEMPLATEPATH . \'/banner468.php\'); ?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

            <div class="singlepost">

                <div class="post" id="post-main-<?php the_ID(); ?>">

                    <div class="entry">

                        <h1 class="post-title single"><a href="<?php the_permalink() ?>" rel="<?php _e("বুকমার্ক", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_title(); ?></a></h1>

                        <?php include (TEMPLATEPATH . \'/postinfo.php\'); ?>

                        <?php if ( get_post_meta( $post->ID, \'video_embed\', true ) ) { ?>
                            <div class="single-video">
                                <?php echo get_post_meta( $post->ID, \'video_embed\', true ); ?>
                            </div>
                        <?php } ?>

                        <?php the_content(); ?>

                        <div style="clear:both;"></div>

                        <?php wp_link_pages(); ?>

                        <?php if(function_exists(\'the_tags\')) { the_tags(\'<p class="tags"><strong>\'. __(\'ট্যাগসমূহ\', "solostream"). \': </strong> \', \', \', \'</p>\'); } ?>
                        <p class="cats"><strong><?php _e(\'বিভাগ\', "solostream"); ?></strong>: <?php the_category(\', \'); ?></p>

                    </div>

                    <?php include (TEMPLATEPATH . \'/auth-bio.php\'); ?>

                    <?php include (TEMPLATEPATH . \'/related.php\'); ?>

                    <?php comments_template(\'\', true); ?>

                </div>

                <?php include (TEMPLATEPATH . "/bot-nav.php"); ?>

            </div>
样式表。php代码

/*-----------[全幅布局样式]-----------*/

.fwidth #page {}

.fwidth #contentleft {
    width: 100%;
    float:none;
    }

.fwidth #content {
    width: 908px;
    }
如果有人需要任何其他代码来获取更多信息,请告诉我。我会提供给你们的。

1 个回复
最合适的回答,由SO网友:Mayeenul Islam 整理而成

您必须编辑single.php 对于post view中的全宽设计single.php 负责显示您的帖子详细信息。

假设,如果您的single.php 如下所示:

+---------------------+
|                     |
+--------------+------+
|              |      |
|              |      |
|              |      |
|              |      |
|              |      |
+--------------+------+
+---------------------+
您的代码如下:

<?php get_header(); ?>

<div id="content" class="single-content">
   CONTENT
<div>

<div id="sidebar">
   <?php get_sidebar(); ?>
</div>

<?php get_footer(); ?>
然后要获得全宽,必须完全删除侧边栏div,并为内容添加100%的宽度,如:

.single-content{width: 100% !important;}
这只是一个概念。我希望你能从这里找到你的解决方案。

结束

相关推荐

ENQUEUE_SCRIPT不适用于HTML5空白主题

我正在尝试使用以下代码将几个js文件排队:function scripts_function() { wp_register_script(\'mapbox\', \'http://api.tiles.mapbox.com/mapbox.js/v0.6.7/mapbox.js\'); wp_enqueue_script(\'mapbox\'); wp_register_script(\'myscript\', plugins_url( \