是否有任何 css 代码可以从站点主页隐藏此功能
Is there any css code to hide this features from site homepage
我正在使用 Discy Wordpress 主题。
我可以使用什么 css 代码来仅在 post 循环中隐藏共享按钮和作者姓名。
Here is a screenshot of what I would like to hide
我建议检查您要在浏览器中隐藏的元素,然后将 display: none
添加到这些元素的 class/id。
例如。假设我想在此处隐藏 'Your Answer' 文本。
然后我会添加一些 CSS
h2.space {
display:none;
}
编辑:
根据您的需要,有几个选项:
编辑 Wordpress 使用的模板以在必要的页面上排除这些元素。
或
插入一些 jQuery 将隐藏特定页面上的元素。
$(document).ready(function() {
if (window.location.href.indexOf("home") > -1) { // What the url contains on the page you don't want these elements to display
$( "h2.space" ).addClass( "hidden" );
}
}
当然,此解决方案需要 jQuery 和 hidden
CSS class 定义,例如:
.hidden {
display: none;
}
您正在使用的 Wordpress 主题中可能已经定义了某种类似的 class。
Fiddle 对于此解决方案:https://jsfiddle.net/p6af32td/
我正在使用 Discy Wordpress 主题。
我可以使用什么 css 代码来仅在 post 循环中隐藏共享按钮和作者姓名。
Here is a screenshot of what I would like to hide
我建议检查您要在浏览器中隐藏的元素,然后将 display: none
添加到这些元素的 class/id。
例如。假设我想在此处隐藏 'Your Answer' 文本。
然后我会添加一些 CSS
h2.space {
display:none;
}
编辑:
根据您的需要,有几个选项:
编辑 Wordpress 使用的模板以在必要的页面上排除这些元素。
或
插入一些 jQuery 将隐藏特定页面上的元素。
$(document).ready(function() {
if (window.location.href.indexOf("home") > -1) { // What the url contains on the page you don't want these elements to display
$( "h2.space" ).addClass( "hidden" );
}
}
当然,此解决方案需要 jQuery 和 hidden
CSS class 定义,例如:
.hidden {
display: none;
}
您正在使用的 Wordpress 主题中可能已经定义了某种类似的 class。
Fiddle 对于此解决方案:https://jsfiddle.net/p6af32td/