Question

I am a programmer, and love jQuery. Visual jQuery and other resources is THE best place to get all the code/function et get your hand dirty...

But when it come to WordPress.. the code is too thin or too abstract... i nee more like a dictionary of term, function, and possibility

What i need is like the ULTIMATE cheat sheet, made in a bible.. i don't care if it 20 pages, i need an HOW TO book of the function possible... like :

  1. wp_list_categories.. where it is and what are the the return values

  2. this snippet i copy from the web : <?php foreach (get_the_category() as $cat){ echo "[" . $cat->cat_name . "] ";} ?> the method cat_name HOW SHOULD I KNOW THAT ???? where to find the reference ??

please enlight me !

Was it helpful?

Solution

Hi @menardmam:

Let's try with what I wrote in the question : $cat->cat_name. How can I know that cat_name is a method that return something from $cat from get_the_category() function?

Frankly the best way to know an answer like that is to use a debugging IDE and to trace through the WordPress core source code. Seriously; the source code is the only documentation that is sure to have been updated, and the results shown in the debugger are the only documentation that is sure to be exactly correct. I use PhpStorm+Zend Debugger but others use NetBeans, others Eclipse, and there are several other PHP IDEs with debuggers too.

Next, you can "google" for your specific questions by including site:codex.wordpress.org as part of your search term and/or search for it here on this site.

As a third and often best way, ask a specific question here on this site. This site works best when you ask specific "How-To" questions with a title that matches your question and with details about your question, and especially your use-case when applicable. Think about it this way:

If someone googles to find the answer you are after, would google ever match their search terms with the title of your question? And when they do find your question would it be very clear to them what question you were asking?

If you can answer "Yes" to both of those then chances are very good you'll get a great answer to your specific question here and you will be likely to get it quickly.

OTHER TIPS

Tell me (us) about that... :) Unfortunately WP is not exactly known for perfect documentation.

There are some basics in Codex, like Function Reference... But what you really need (and will end up using anyway) is either cross-reference of the code or good PHP-aware IDE.

Like it or not - reading WP source code is essential part of getting proficient with it.

$cat->cat_name. I can i know that cat_name is a method that return something from $cat from get_the_category() function ?

It is not a method, it is a field of category object. Many items in WordPress (posts, taxonomies, etc) are represented internally by object. For some it is straight conversion of how are they stored in database, for others its more abstract.

Codex has descriptions or examples for some objects like categories and posts.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top