dongzhunqiu4841 2016-08-22 23:20
浏览 29

从wordpress帖子页面删除侧栏并重播

I am looking for help to remove "junk" widgets from my wordpress website. Website theme is Zerif Lite and on every page so far there was no sidebar,however when I make a new post there is alot of junk (sidebar,who posted it,when,how entry was tagged and replay option). I tried removing it from appearance->widgets and it didnt work and theme customization for widgets is locked for lite version.

So for start I 1st want to remove sidebar that include search,archives and meta.Only thing that worked so far was blanking out sidebar.php that include:

<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 -->

However when I did that sidebar was removed,but space it took was blank,meaning post itself was only using 2/3 of page.

To get you to see for your self here are links to site (its in serbian,ignore that):

website and:

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

So if anyone can help me remove all that and make page clean I would be very greatfull. Thanks

  • 写回答

1条回答 默认 最新

  • douyou9923 2016-08-22 23:40
    关注

    The problem is css

    Here is the solution (only if you dont use sidebar anywhere in your site)

    Change the width of your content container, maybe right now is set to 70%(remaining 30% is for sidebar) to 100%.

    If you plane to use sidebar, then you need set a conditional class in your 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' );
    

    Then only customize the css with the new class. Ex:

    .content .nosidebar {
    width:100%
    }
    

    Cheers

    评论

报告相同问题?

悬赏问题

  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出