javascript 在 Wordpress 中编辑源代码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6459371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 20:45:31  来源:igfitidea点击:

Editing Source Code in Wordpress

javascriptwordpress

提问by Christian

The company I am working with hosts their webpage on Wordpress. They want me to edit some of the code in order to do various things, such as enable a photo container to be a moving slideshow.

与我合作的公司在 Wordpress 上托管他们的网页。他们希望我编辑一些代码以执行各种操作,例如使照片容器成为移动幻灯片。

Figuring out the javascript and html to achieve the results they desire is not problematic for me. However, I am unsure how to get full access to the Source Code of the site. I have privileged access to the backend of the site but in wordpress when you go to edit it only shows some of the basic html tags while hiding the <div>and <script>tags and code. Is there any way edit the page in its source code format? I don't want to have to go through the simplified and less expressive/less control Wordpress interface, and I don't even know if I can achieve the desired results with it.

弄清楚 javascript 和 html 以实现他们想要的结果对我来说不是问题。但是,我不确定如何完全访问该站点的源代码。我有特权访问站点的后端,但在 wordpress 中,当你去编辑它时,它只显示一些基本的 html 标签,同时隐藏<div><script>标签和代码。有没有办法以源代码格式编辑页面?我不想通过简化和较少表现力/较少控制的Wordpress界面,我什至不知道我是否可以用它达到预期的结果。

回答by Varun Madiath

If you try and edit individual pages you're approaching the problem in the wrong way. You probably want to be using a plugin or modifying a plug-in to create the slideshow you need. There are many plugins for wordpress that do what you seem to need.

如果您尝试编辑单个页面,那么您就是在以错误的方式解决问题。您可能希望使用插件或修改插件来创建您需要的幻灯片。有许多 wordpress 插件可以满足您的需求。

slider-widgetis one such pluging

滑块小部件就是这样一种插件

回答by markratledge

In Wordpress, there are two main parts to the website's front and backend: the core WP files and the theme that is used. (And other important aspect to a WP site is the database, where all content is stored, including text/images entered in the admin backend.)

在 Wordpress 中,网站的前端和后端有两个主要部分:核心 WP 文件和使用的主题。(WP 站点的另一个重要方面是数据库,其中存储了所有内容,包括在管理后端输入的文本/图像。)

Core WP files are not to be changed because they get overwritten with each update. What you want to work with is the theme. Look in Appearance>>Themes and see what the active theme is for the site. It will also tell you the name of the folder the theme files are in.

核心 WP 文件不会更改,因为每次更新都会覆盖它们。您想要使用的是主题。查看外观>>主题,看看网站的活动主题是什么。它还会告诉您主题文件所在的文件夹的名称。

With FTP, go to root/wp-content/themes/your-theme-name. That's the php, html and css source of the displayed part of the site. Uploaded images are in /uploads/, and plugins in /plugins/.

使用 FTP,转到 root/wp-content/themes/your-theme-name。这是网站显示部分的 php、html 和 css 源代码。上传的图片在 /uploads/ 中,插件在 /plugins/ 中。

See http://codex.wordpress.org/Theme_Developmentto get an idea of how themes are built and how to modify them.

请参阅http://codex.wordpress.org/Theme_Development以了解如何构建主题以及如何修改它们。

See the rest of the docs at WP to see how to work with plugins, add other javascript correctly so it doesn't conflict with WP's included javascripts, etc. All the docs you really need are at wordpress.org

请参阅 WP 上的其余文档,了解如何使用插件、正确添加其他 javascript 以免与 WP 包含的 javascript 等冲突。您真正需要的所有文档都在 wordpress.org