admin管理员组文章数量:1323707
OK so everyone must ask how to see the php source code sometime and I asked it to myself too.
and yes I know it that the php is processed by the server before outputting it to web page, so with that in mind, is there any way I can actually see what the php code looks like when a page is requested and before it goes into my own web server and is processed?
I've got access to my server and the config etc so I can't see why this wouldn't be possible, but I wouldn't know how?
OK so everyone must ask how to see the php source code sometime and I asked it to myself too.
and yes I know it that the php is processed by the server before outputting it to web page, so with that in mind, is there any way I can actually see what the php code looks like when a page is requested and before it goes into my own web server and is processed?
I've got access to my server and the config etc so I can't see why this wouldn't be possible, but I wouldn't know how?
Share Improve this question asked Feb 23, 2017 at 18:28 AutoBakerAutoBaker 1702 silver badges11 bronze badges 1- thank you for your post, this is more of a question for the hosting support service of your host to answer. – David Lee Commented Feb 23, 2017 at 18:39
1 Answer
Reset to default 3Yep, of course that's possible. There are several ways of viewing the php source code of your theme, of your plugins and of WordPress itself.
I assume that you are interested in the php code of your theme - that's mostly what's generating the public facing HTML that gets served to the site visitor's browser.
The tricky part is to know which file is actually producing a given page. For this, WordPress theme developers like to refer to a graph the visualizes the Template Hierarchy, such as this one:
This picture shows the processing logic of a WordPress theme, and helps you understand what file to look after. For instance, if you are looking at a Page content type (not the same as a Post), it is most likely produced by the page.php
file included in your active theme.
Once you know that, there are several ways to view the code:
- Inside your site dashboard, navigate to Appearance > Editor. Here you can view the different files of your theme. Be aware that editing them here is quite risky, as every change will impact the site.
- By connecting to your server over the file transmission protocol of your choice (FTP, SFTP, SSH...), you can navigate to the WordPress files and view their content. The theme files are located in
wp-content/themes/name-of-your-theme/
. - If you know your theme's name, you can simply download a copy from the wordpress Theme Directory, and explore them at will using a code editor - probably a good and safe way to learn.
Finally, an important concept to understand is that your actual content isn't stored in the php files - it's saved to the database. That explains how a single template, such as page.php
, can display dozens or hundreds of different pages.
本文标签: Can I view my own wordpress php source code on my hosted web server
版权声明:本文标题:Can I view my own wordpress php source code on my hosted web server? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742129821a2422108.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论