admin管理员组文章数量:1122832
How can I hide just the author from the post meta in search results, while keeping the date and categories?
I know I can use something like:
.post-meta .author { display: none; }
to hide the author name, but that still leaves me with "by" and a vertical separator before the date.
"by" and the separator are not linked to any class, so how can I target and hide them, without hiding the entire .post-meta
?
I'm using Divi, if that matters, and here is the full markup of the meta section:
<p class="post-meta">by <span class="author vcard"><a href="[link to author page]" title="Posts by [me]" rel="author">[my name]</a></span> | <span class="published">Jun 3, 2019</span></p>
How can I hide just the author from the post meta in search results, while keeping the date and categories?
I know I can use something like:
.post-meta .author { display: none; }
to hide the author name, but that still leaves me with "by" and a vertical separator before the date.
"by" and the separator are not linked to any class, so how can I target and hide them, without hiding the entire .post-meta
?
I'm using Divi, if that matters, and here is the full markup of the meta section:
<p class="post-meta">by <span class="author vcard"><a href="[link to author page]" title="Posts by [me]" rel="author">[my name]</a></span> | <span class="published">Jun 3, 2019</span></p>
Share
Improve this question
edited Sep 6, 2019 at 20:04
RiddleMeThis
3,7878 gold badges21 silver badges30 bronze badges
asked Sep 6, 2019 at 19:00
ManlyManly
1435 bronze badges
2
- Your best bet would be to edit the template that is generating the post meta, then you could display exactly what you want. – RiddleMeThis Commented Sep 6, 2019 at 19:59
- The structure of the HTML means that you can't do this with CSS. You'll need to change the template. – Jacob Peattie Commented Sep 11, 2019 at 9:51
1 Answer
Reset to default 0As stated in my comment the best solution would be to create a child theme and edit the file generating the post meta. This would give you full control of what is being generated and you won't have to worry about hiding unwanted content via CSS.
However, you could hide the text nodes and show the elements you want by doing something like this...
.post-meta {
visibility:collapse;
}
.published {
visibility:visible;
}
Note: The above hidden items will still keep their space in the DOM, so you could add float:left to .published to break the flow.
本文标签: phpHide author from search results metastill display date and categories
版权声明:本文标题:php - Hide author from search results meta, still display date and categories 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736295226a1929526.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论