开发者

Pretty-printing Wordpress HTML output for development purposes

开发者 https://www.devze.com 2023-01-12 16:33 出处:网络
Is there a simple way (plugin / function) that uses Tidy or some other lib to pretty-print Wordpress\'s HTML output?

Is there a simple way (plugin / function) that uses Tidy or some other lib to pretty-print Wordpress's HTML output?

It's unreadable as it is and it'开发者_Go百科s almost impossible to write a theme with proper indentation with all the includes / hooks going on all over the place.

Performance is not an issue as this only needs to be active for development purposes.


I suggest:

  1. Get Firebug
  2. Use PHP heredocs
  3. Include whitespace in your output using \n (newline), \t (tab), etc.


Give Kint PHP Debugger a try.

Works great for doing var_dumps with a nice UI.

Example:

$items = array('pine', 'apple', array('numbers' => [1,2,3,4]));
d($items);
0

精彩评论

暂无评论...
验证码 换一张
取 消