Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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 如何在我的Wordpress主页上使某些部分/行图像全宽?_Php_Wordpress_Css_Width - Fatal编程技术网

Php 如何在我的Wordpress主页上使某些部分/行图像全宽?

Php 如何在我的Wordpress主页上使某些部分/行图像全宽?,php,wordpress,css,width,Php,Wordpress,Css,Width,我正在一家新的创业公司工作,在我的初始MVP中使用Wordpress和Woothemes。我使用了喧闹的主题,一切看起来都很华丽。虽然我有点迂腐,但我希望在“主页”上全宽显示某些图像,而其他部分保持99 em宽 最好的方法是什么?我不是很擅长PHP,但我想把它做好。改变CSS代码是最有效的方法吗?那么,我该如何隔离一个部分并使其全宽 以下是我想制作全宽I.o.w的一个部分的CSS,它应该覆盖其中的块: .home-section#intro-message { width: margi

我正在一家新的创业公司工作,在我的初始MVP中使用Wordpress和Woothemes。我使用了喧闹的主题,一切看起来都很华丽。虽然我有点迂腐,但我希望在“主页”上全宽显示某些图像,而其他部分保持99 em宽

最好的方法是什么?我不是很擅长PHP,但我想把它做好。改变CSS代码是最有效的方法吗?那么,我该如何隔离一个部分并使其全宽

以下是我想制作全宽I.o.w的一个部分的CSS,它应该覆盖其中的块:

.home-section#intro-message {
  width: 
  margin-top: -6.854em;
  padding: 6.854em 0;
  border-bottom: 5px solid #e5e5e5;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
PHP文件:

<?php
// File Security Check
if ( ! function_exists( 'wp' ) && ! empty( $_SERVER['SCRIPT_FILENAME'] ) && basename( __FILE__ ) == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
    die ( 'You do not have sufficient permissions to access this page!' );
}
?><?php
/**
 * Index Template
 *
 * Here we setup all logic and XHTML that is required for the index template, used as both the homepage
 * and as a fallback template, if a more appropriate template file doesn't exist for a specific context.
 *
 * @package WooFramework
 * @subpackage Template
 */
    get_header();
    global $woo_options;

    $settings = array(
                'homepage_enable_intro_message' => 'true', 
                'homepage_enable_blog_posts' => 'true', 
                'homepage_enable_promotion' => 'true', 
                'homepage_enable_featured_products' => 'true',
                'homepage_enable_features' => 'true',
                'homepage_enable_testimonials' => 'true',
                'homepage_number_of_features' => 3, 
                'homepage_number_of_testimonials' => 3, 
                'homepage_features_area_title' => '', 
                'homepage_testimonials_area_title' => ''
                );

    $settings = woo_get_dynamic_values( $settings );

?>

    <div id="content" class="col-full">

        <?php woo_main_before(); ?>

        <section id="main" class="col-full fullwidth">      
        <?php if ( is_home() && ! dynamic_sidebar( 'homepage' ) ) {
            if ( 'true' == $settings['homepage_enable_intro_message'] ) {
                get_template_part( 'includes/intro-message' );
            }

            if ( is_woocommerce_activated() && 'true' == $settings['homepage_enable_featured_products'] ) {
                get_template_part( 'includes/featured-products' );
            }

            if ( 'true' == $settings['homepage_enable_features'] ) {
                $args = array( 'title' => $settings['homepage_features_area_title'], 'size' => 235, 'per_row' => 3, 'limit' => $settings['homepage_number_of_features'] );
                $args['before'] = '<section id="features" class="home-section widget_woothemes_features">';
                $args['after'] = '</section>';
                $args['before_title'] = '<header class="block"><h1>';
                $args['after_title'] = '</h1></header>';

                do_action( 'woothemes_features', $args );
            }       

            // Featured Slider.
            woo_featured_slider_loader();

            if ( 'true' == $settings['homepage_enable_testimonials'] ) {
                $args = array( 'title' => $settings['homepage_testimonials_area_title'], 'size' => 80, 'per_row' => 3, 'limit' => $settings['homepage_number_of_testimonials'] );
                $args['before'] = '<section id="testimonials" class="home-section widget_woothemes_testimonials">';
                $args['after'] = '</section>';
                $args['before_title'] = '<header class="block"><h1>';
                $args['after_title'] = '</h1></header>';

                do_action( 'woothemes_testimonials', $args );
            }

            if ( 'true' == $settings['homepage_enable_blog_posts'] ) {
                get_template_part( 'includes/blog-posts' );
            }

            if ( 'true' == $settings['homepage_enable_promotion'] ) {
                get_template_part( 'includes/promotion' );
            }

        ?>
        <?php } ?>    
        </section><!-- /#main -->

        <?php woo_main_after(); ?>

    </div><!-- /#content -->

<?php get_footer(); ?>

由于代码太少,我们无法给出正确答案,只能猜测

如果整个网站在容器中包装,并且只希望1个部分为全宽度,那么您可以考虑更改该页面的HTML结构,即.k.a/p> 代替:

<div class="container">
    <div class="row">

    </div>
    <div class="row">

    </div>
</div>

应成为:

<div class="row">
    <div class="container">

    </div>
</div>
<div class="row">
    <div class="container">

    </div>
</div>

(我考虑到容器和该节之间可能存在其他元素,如果不调整css以重新打开所有节,则无法关闭包含所有节的容器) 如果容器放置在header.php中,您可以在header中关闭它(仅适用于此模板/页面),并在页面/模板中创建一个新的容器,并使用上面的结构


也有JS解决方案,但既然可以很简单,为什么还要把事情复杂化呢。

谢谢。我试过了。请参阅我添加了需要编辑的PHP文件,以便“homepage\u enable\u intro\u message”=>“true”位于其自己的CSS块下。目前,一切都处于不利地位。因此,我添加了自己的部分,但无法正确地获取PHP部分,并返回到原始PHP文件,如上所述。