关于 php:WordPress 侧边栏与内容不对齐 | 珊瑚贝

WordPress sidebar not align with content


它让我发疯,因为我不是代码高手,使用模板\\’submate\\’我试图在 children 主题优势上添加右侧边栏

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
 * This template displays full width pages with a page title.
 *
 * @package vantage
 * @since vantage 1.0
 * @license GPL 2.0
 *
 * Template Name: submate
 */

get_header(); ?>

<?php
//get the sidebar
$avia_config[‘currently_viewing’] = ‘page’;
if(is_front_page()) { $avia_config[‘currently_viewing’] = ‘frontpage’; }
get_sidebar();
?>
               
    <?php if(function_exists(‘bcn_display’))
    {
        bcn_display();
    }?>

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

        <?php get_template_part( ‘content’, ‘page’ ); ?>

    <?php endwhile; // end of the loop. ?>

<?php get_footer(); ?>

它的链接是; http://www.seasonalharvest.co.uk/recipes/february/

非常感谢您的帮助:)

  • 将文章向左浮动,并给它一个宽度。您可能也想摆脱文章周围的 3 级深度 标记。


您的文章的 html 结构非常糟糕。您已将 article 元素包裹在 strong 元素中,这没有意义,因为它用于使文本更粗。

无论如何,您都可以将这个小片段添加到您的 wp-content/themes/your-theme/style.css

1
2
3
4
article[class*=“post”] { /* only post articles */
    float: left;
    width: 65%;
}

编辑

仅适用于特定页面:

1
2
3
4
.pageid231 article[class*=“post”] { /* only post articles */
    float: left;
    width: 65%;
}

  • 谢谢你,它解决了问题,但是它使我所有其他页面文章的宽度
  • @user3359955 您只需要特定页面吗?请参阅我的编辑答案。


试试这个…

1
2
3
4
5
6
<style type=“text/css”>
article#post-231 {
   float: left;
    width: 65%;
}
</style>

来源:https://www.codenong.com/22065449/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_8917.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?