2014年9月23日星期二

NetTuts.com: A Practical Use of WordPress Global Variables


On the NetTuts.com site there's a new post (a part of a series) that introduces you to the global variables available in WordPress and provides a practical use for them.



In the first article in this series, we reviewed an introduction to WordPress global variables. Specifically, we said that they are variables that hold a variety information that can be accessed from anywhere in the WordPress page lifecycle. We learned how to access a global variable and display various details about the latest post using the $post global variable. In today's article, we will dive further into global variables by learning how to access them to display the author information.


In this post they focus on extracting user (author) data from the system via the "authordata" global variable. He shows an example of a print_r output of the data it contains and use this to filter posts, only showing three per-author.


Link: http://code.tutsplus.com/tutorials/a-practical-use-of-wordpress-global-variables--cms-20854

没有评论:

发表评论