Friday, January 25, 2013

Wordpress Functions

Wordpress has built-in functions to do the include wp_include() for example. There are many other helpful functions Wordpress has in the core functions, get_bloginfo() and bloginfo() are very helpful. the second of which echos the result while the first doesn't (this distinction is good to know because if you use echo bloginfo('template_directory') you will probably get the result printed to the page when you didn't want that to happen). Using bloginfo('template_directory') will give you "yoursite.com/wp-content/themes/activetheme/". This is so nice! If you ever move your site, this will change too and links to images/pages/css files/etc... won't break. Use bloginfo('url') anytime you want to insert "yoursite.com" and save yourself a ton of heartache. All of the bloginfo() arguments can be found at the Wordpress Codex/Function Reference/bloginfo. The codex is very well kept and very expansive.

There are many individuals who keep separate blogs with suggestions, code examples/snippets, and general discussions about Wordpress. Many who design themes and plugins, many are free and many are not. If there is something  you want Wordpress to do, chances are someone has asked the question, and/or found a solution. The Wordpress forums are very well kept. Search first, but don't be afraid to ask.

No comments:

Post a Comment