Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rocket domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/practical-tips.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the soledad domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/practical-tips.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the soledad domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/practical-tips.com/wp-includes/functions.php on line 6114
ChatGPT:创建一个WordPress插件-它是如何工作的 - Practical Tips

ChatGPT:创建一个WordPress插件–它是如何工作的

by Michaela

虽然你以前需要一个程序员来做这件事,但今天你可以用ChatGPT开发一个WordPress插件。这样你就可以单独向CMS添加新的功能。

用ChatGPT编写一个WordPress插件:这是工作原理。

在你用ChatGPT写一个WordPress插件之前,你首先要知道一个插件是如何工作的。

  • 一个WordPress主题是用服务器语言PHP编写的。你可以用ChatGTP轻松地生成PHP代码。
  • 要把完成的代码变成一个主题,你必须先把它复制到一个文本文件中,并以文件名的扩展名”.php “保存它。
  • 现在将创建的php文件移动到一个新的文件夹中,并将其命名为与文件相同的名字。
  • 压缩该文件夹。在WordPress中,通过侧边栏导航到 “安装插件”.
  • 点击顶部的 “上传插件”,安装你创建的插件。

WritingPHP with ChatGPT: How to build the prompt

要想从ChatGPT中得到回应,你必须首先提出一个问题。这就是所谓的提示。

  • 尽可能具体地表述你的提示。指定一个WordPress插件应该用PHP8编写:”编写一个与PHP兼容的WordPress插件… “
  • 准确描述你希望你的插件做什么以及它是如何工作的。一定要包括任何需要的设置页面。
  • 如果生成的结果仍然不符合您的期望,请要求进行修正。ChatGPT会识别上下文,并改变先前交付的代码,使其执行新的任务。
  • 注意,ChatGPT也会犯错误。因此,特别是在安全关键领域,你应该在生产性使用前仔细测试该插件,并让有经验的程序员检查。

Related Articles

Leave a Comment