1
2
3
4
五
6 |
<?php /* * Template Name: Full-Width */ get_header(); ?> |
full-width.php
计算机上。
此代码只是定义模板文件的名称,并要求WordPress获取标头模板。
接下来,您将需要代码的内容部分。使用FTP客户端(或cPanel中的文件管理器)连接到您的网站,网站优化与SEO,然后转到/ wp-content / themes / your-theme-folder /。
现在您需要找到名为page.php的文件。这是您主题的默认页面模板文件。
复制该get_header()
行后的所有内容并将其粘贴到计算机上的full-width.php文件中。
现在你需要查看full-width.php文件并删除这行代码:
1 |
<?php get_sidebar(); ?> |
1
2
3
4
五
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 |
<?php /* * Template Name: Full-Width */ get_header(); ?> <div id= "primary" class = "content-area" > <main id= "main" class = "site-main" role= "main" > <?php // Start the loop. while ( have_posts() ) : the_post(); // Include the page content template. get_template_part( 'template-parts/content' , 'page' ); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) { comments_template(); } // End of the loop. endwhile ; ?> </main><!-- .site-main --> </div><!-- .content-area --> <?php get_footer(); ?> |
1
2
3
4
五
6
7
8
9
10 |
.page-template-full-width .content-area { width : 100% ; margin : 0px ; border : 0px ; padding : 0px ; } .page-template-full-width .site { margin : 0px ; } |