修复了 Wordpress + 静态行中的 Header

Fixed Header in Wordpress + Static Lines

我正在使用令人眼花缭乱的主题创建 this site,除了 header.

之外,一切似乎都运行良好

已将这些代码行添加到我的 css 中,如您所见,它在主页上运行良好。

position: fixed;
z-index: 99;
width: 100%;

但是,当您访问任何其他页面或博客 post 时,header 就乱七八糟了。能否请您提供解决方案。

另一个问题是,在首页carousal,我需要在博客摘录中添加几行(Art brings faith to life. This blog.....)。可以通过 CSS 完成吗?

解决了两个问题:

  1. 添加单行top:0;成功了。感谢社区的帮助。
  2. 看来,问题出在默认的 WP 摘录 55 上。在 functions.php 文件中使用了一个函数,它成功了。如果它可能对其他人有帮助,请在下面提到它。

    /* New excerpt length of 120 words*/
    function my_excerpt_length($length) {
    return 70;
    }
    add_filter('excerpt_length', 'my_excerpt_length');
    

您可以将 70 更改为您喜欢的任何值:)

对于您的第一个问题菜单出现问题是因为您为内容 ID 设置了 margin-top。

保持原样,如果你需要,改变你css

style.css 第 612 行

你必须

.navbar.navbar-default
{
leave other css as it is and change only
position: fixed;
top: 0; /* This one you miss*/
and remove margin
}

其次,您可以增加博客摘录的宽度或高度 div。 在 flexslider.css 第 98 行

只需在此 css 规则中添加 top:0 即可。navbar.navbar-default

.

navbar.navbar-default {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    font-weight: 200;
    margin-bottom: 0;
    margin-top: -2px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 99;
}