简体   繁体   中英

Modifying a WordPress theme

I am in the process of heavily customising a WordPress theme. The theme is quite complex so it is hard for me to identify how and where data is rendered from all the different files in the theme.

Is there a plugin for a browser which tells me what file in the theme a specific element is generated from?

please have a look at these plugins.

It will definitely help you.

[1] http://wordpress.org/extend/plugins/debug-bar/

[2] http://wordpress.org/plugins/debug-bar-template-trace/

Just install in your theme, and go to the page and trace it through this plugin, it will show you, from which file's code is executing right now...

Thanks.

The thing you'll find most useful, or at least the thing I've always found most useful, is the Wordpress template hierarchy.

It's a graphic that shows which files Wordpress will attempt to find to render a page of the site, for instance when showing a page, rather than a post, wordpress looks for a file called page-{id}.php (where {id} is the numerical id of the page) first, then page-{slug}.php, then page.php then index.php.

Using the hierarchy flow diagram, you can see which files Wordpress would try and in what order, and by comparing this to the files in your theme, you can quickly track down which file it is.

http://codex.wordpress.org/Template_Hierarchy - Scroll down to the image, it's the most useful bit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM