Wordpress PHP Help needed...
Out of context: Reply #8
- Started
- Last post
- 9 Responses
- acescence0
i suggest the starkers theme as well. you certainly don't need any php knowledge, but learning some bits can make a huge difference in what you can do. i think the developer documentation is really good.. http://codex.wordpress.org/Devel…
the first thing is understanding the template system and what files are used for what pages. you can have 1 file and every page uses that 1 template, or you can have a category template, a single post template, etc., based on what you name the files. there are also conditional tags, which let you check what page was requested and load other templates or display markup based on that. http://codex.wordpress.org/Condi…
here it's necessary to grasp how if/then/else conditional logic works in php.the main ingredients then are the template tags, they let you access the fragments of data that make up a page: title, content, link, date, etc.. some of them insert html on the page, others let you access just the raw bits of data to insert into your own markup. http://codex.wordpress.org/Templ…
a big part of the template tags is "the loop", and understanding how loops work in php in general. loops let you repeat a block of code to deal with collections of data, in this case a collection of posts on a page. wherever you see "while ()" or "for ()" in the templates, these are loops.
once you understand the loop, you can get into using multiple loops on a page to get additional data, like a related posts section, or building pages with categories displayed separately, or showing both post and page data, etc..
the last super jedi level is writing your own sql queries, which lets you do whatever, like getting posts based on custom field / tag / category. oh yeah, check out custom fields, these are good for adding extra data to pages. i use them for thumbnails, flash slideshows, mp3 playlists, artist / album / format data (which you can then select and sort on with your own queries). the possibilities are vast.