开发者

Wordpress creating custom theme-Reusability

开发者 https://www.devze.com 2023-03-20 09:40 出处:网络
first approach to CMS and wordpress I\'m wondering if there\'s any predefined html structure and classes/IDs \"must-be\" reference that I can refer for 开发者_运维问答making my own theme willing to ch

first approach to CMS and wordpress I'm wondering if there's any predefined html structure and classes/IDs "must-be" reference that I can refer for 开发者_运维问答making my own theme willing to change in the future for another wordpress theme

thanks

Luca


There are a few other 'template' themes that could get you started - if Starkers isn't quite your thing, you might find WP Framework a good alternative. Or - just start stripping down the Twenty Eleven theme to give you a base (which is just what the Starkers theme does, using the Twenty Ten theme as a base).

There's also quite a handy first-time guide on the WordPress Codex around theme development if you'd prefer to start from scratch.


Wordpress doesn't require you to have any specific classes or IDs in your theme in terms of the HTML and CSS, the only things WP needs are things like the wp_head function inside your element on every page. Having said that themes such as Starkers were created to enable developers to have a starting point instead of starting from scratch.

Now the above applies only to whatever code you write, there are however some functions in WP that will return standard code, for instance if you don't specifically create the comment thread code, WP will generate it for you, and that is really the only code that many themes will share.

I would say that if you are intending on making a number of blogging themes for instance, having a set of standard code might be a good idea, for the article pages for example, so that you don't have to re-write code over and over. Aside from that the only code I ever reuse when making themes is the CSS to style comments if I don't hand-code the comments section, this is a good idea as it will save you a lot of time.


Wordpress provide some functions which add CSS classes depending of page type, templete, conditional tags . . .etc.

These functions are body_class() and post_class().

For more info check:

http://codex.wordpress.org/Function_Reference/post_class http://codex.wordpress.org/Function_Reference/body_class

0

精彩评论

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