【问题标题】:Remove sidebar and replay from wordpress post page从 wordpress 帖子页面删除侧边栏和重播
【发布时间】:2016-12-29 15:10:09
【问题描述】:

我正在寻求帮助以从我的 wordpress 网站中删除“垃圾”小部件。网站主题是 Zerif Lite,到目前为止,在每个页面上都没有侧边栏,但是当我发布新帖子时,会有很多垃圾(侧边栏,发布者,何时,如何标记条目和重播选项)。 我尝试将其从外观中删除->小部件,但它不起作用,并且小部件的主题自定义已针对精简版锁定。

因此,首先我想删除包含搜索、存档和元数据的侧边栏。到目前为止,唯一有效的是删除 sidebar.php,其中包括:

<div id="secondary" class="widget-area" role="complementary">

    <?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>

        <aside id="search" class="widget widget_search">

            <?php get_search_form(); ?>

        </aside>

        <aside id="archives" class="widget">

            <h2 class="widget-title"><?php _e( 'Archives', 'zerif-lite' ); ?></h2>
            <ul>
                <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
            </ul>

        </aside>

        <aside id="meta" class="widget">

            <h2 class="widget-title"><?php _e( 'Meta', 'zerif-lite' ); ?></h2>

            <ul>
                <?php wp_register(); ?>
                <li><?php wp_loginout(); ?></li>
                <?php wp_meta(); ?>
            </ul>

        </aside>

    <?php endif; ?>

</div><!-- #secondary -->

但是当我这样做时,侧边栏被删除了,但它占用的空间是空白的,这意味着帖子本身只使用了 2/3 的页面。

为了让你自己看到这里是网站的链接(它是塞尔维亚语,忽略它):

website 和:

new post, this you can only see with this link,its where problem is

因此,如果有人可以帮助我删除所有这些并让页面变得干净,我会非常高兴。谢谢

【问题讨论】:

    标签: php css wordpress widget sidebar


    【解决方案1】:

    问题是css

    这是解决方案(仅当您不使用站点中的任何地方的侧边栏时)

    更改内容容器的宽度,可能现在设置为 70%(剩余 30% 用于侧边栏)到 100%。

    如果你打算使用侧边栏,那么你需要在你的functions.php中设置一个条件类:

    function custom_body_classes( $classes ) {
    // Adds a class of nosidebar to sites without active sidebar.
    if ( ! is_active_sidebar( 'sidebar-1' ) ) {
    $classes[] = 'nosidebar';
    }
    return $classes;
    }
    add_filter( 'body_class', 'custom_body_classes' );
    

    然后只使用新类自定义 css。例如:

    .content .nosidebar {
    width:100%
    }
    

    干杯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多