仅在页面上显示内容

Display content on a page only

我尝试使用此代码在 Wordpress 中仅显示特定页面#content 但无法正常工作...

body.page-id-2 .masthead-fixed .site-main {
display: none;
}

这是网站:

http://avocat.dac-proiect.ro/wp/

我在网上搜索了一下,我看到例子可以做到,但我不工作

我哪里错了?

提前致谢!

您想隐藏所有这些元素吗?

body.page-id-2, 
.masthead-fixed, 
.site-main {
    display: none;
}

.page-id-2.masthead-fixed在你的html中处于同一水平,所以你必须这样:

body.page-id-2.masthead-fixed .site-main {
    display: none;
}

或完全删除 .masthead-fixed 选择器:

body.page-id-2 .site-main {
    display: none;
}