开发者

Is there a template hiearachy in Wordpress similar to Django?

开发者 https://www.devze.com 2023-01-12 09:23 出处:网络
I\'m a veteran Django programmer and a newbie in WordPress. In Django, we have the concept of templating such that I can create File1 which contains some html blocks that can be overriden by child Fil

I'm a veteran Django programmer and a newbie in WordPress. In Django, we have the concept of templating such that I can create File1 which contains some html blocks that can be overriden by child File2. We are using {block block1} syntax in Django. This makes re-use in django very easy. In PHP (WordPress) do we have the same concept? I want to make File1 and override so开发者_Go百科me of its html blocks by File2.


I don't know Django at all, but if I'm interpreting your statements correctly then there is no templating construct in that sense.

Wordpress child themes override the entire file from the parent theme using the same file in the child theme.

A way to achieve what you want might be to write a plugin that rewrites the theme output in the areas you're concerned with, The output model for Wordpress allows developers to hook in to events in the page life-cycle and modify the html to be output before it's sent to the browser.


Yes! Wordpress have hierarchy for templates/themes too. These are called Child themes.

the functions.php of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme.

Here is the best tutorial I could find.

0

精彩评论

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