dsiimyoc804955 2016-07-01 15:45 采纳率: 100%
浏览 50
已采纳

删除Wordpress自定义帖子类型(和博客帖子)上的“元信息” - CSS还是PHP?

I am wondering about the best way to remove/edit meta info from custom post types and blog posts in Wordpress.

Is it best to use CSS, or to make a change in a php file? (I have created a child theme, but I don't know PHP, so I'm reluctant to fiddle around with it).

On both standard posts, and on custom posts such as this one (https://www.violinschool.org/video/tuning-the-violin/), I am trying to:

a) remove the text 'posted on' and 'by', so that only the date appears. (first red annotation)

b) remove the text 'This entry was posted in Uncategorized. Bookmark the Permalink.', so that only the 'Edit' link for administrators (in the red square annotation) is left on the page.

Is there any way to make a fix with CSS so that I can avoid getting into PHP code I don't understand? Or is it crucial to do this change in PHP in the child theme?

Thank you very much!

enter image description here

  • 写回答

1条回答 默认 最新

  • douhuireng4407 2016-07-01 17:34
    关注

    No, it is not crucial to remove these options through PHP. You can simply hide them with CSS if you are more comfortable. However, if you want to get technical about responsible coding, then you should absolutely remove the code from PHP.

    The reason being as whatever you are hiding from view is still being downloaded by the browser and placed on the page, and then hidden by CSS. In this case, the text may not amount to much, but it is still KB being downloaded (think about foreign countries who pay per MB of data downloaded on their mobile data plan). Not to mention a few extra lines of CSS to hide the code, which will also unnecessarily increase the size of the CSS file since you could have avoided writing those lines of code in the first place (again, extra KB downloaded). And then there is also adaptability to consider, as the code that is simply hidden from view on the page will still be picked up by a screen reader.

    So... if you want to be responsible, you should learn a little PHP and do this the right way. If you just don't care... hide the lines with CSS.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行