duangong937906 2014-04-25 10:43
浏览 38
已采纳

WordPress的。 如何防止WordPress删除我手写的代码

For the sake of testing, I implemented some features in the template I use.

For example I inserted this in the index.php file and other files where I need this item to be:

<div class="test-contact">
    <a href="#">
    Contact us
    </a>
</div>

Then the WP update appeared and also update of the template. I updated it all and my item disappeared from the pages.

Is there any way I can make sure my editions will not disappear, for example, at the costumer's site if he decides to update something? How do you deal with that.

I haven't found anything relevant neither here, nor @ google. Hope someone can heads up.

Regards.

  • 写回答

1条回答 默认 最新

  • dssqq64884 2014-04-25 10:47
    关注

    Presumably the index.php file you edited belonged to a theme that you've installed on the wordpress installation. If this an externally developed theme when the creator releases an update it will replace all the files with the new version as described.

    In this instance it would be wise to create a child theme. These inherit the functionality of the parent theme whilst retaining your customized templates and code.

    An alternative method of achieving what you described above to to make use of the widget areas available in the theme. Many themes include multiple areas for placing dynamic widgets and arbitrary text or html in the form of a text widget. You can place your custom html in a text widget and place the widget in the appropriate "sidebar".

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

报告相同问题?

悬赏问题

  • ¥15 hexo+github部署博客
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?