Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

Brittany Cerra
Brittany Cerra
7,424 Points

Trouble connecting the dots with Wordpress Functions.

I'm confused about variables and functions in Wordpress. Which file has identified the variables and functions, for example, the_title(), bloginfo(), or wp_title(). Is this automated in Wordpress? Is it pulling from info entered on the admin page? Is this something I'm supposed to define in my code or in the comments of my style sheet? Lost... :(

3 Answers

Crisoforo Gaspar Hernández
Crisoforo Gaspar Hernández
18,302 Points

The functions the_title(), bloginfo() or wp_title() are functions that exist.

For example the_title() is a function located in wp-includes/post-template.php

You can check it out in the documentation: http://codex.wordpress.org/Function_Reference/the_title as well as the others functions.

What do you mean for something you are supposed to defined?

Brittany Cerra
Brittany Cerra
7,424 Points

Thanks for the response! For me, the documentation might as well be in another language. Hah! I'm speaking of their source. When you say exsist, do you mean that I would've had to previously define them? If not, then they are previously defined by Wordpress? Is that what you meant when you said, "For example the_title() is a function located in wp-includes/post-template.php"? If they are defined by wordpress, where and how is wordpress pulling the specifics for a site? #endnovelofquestions

Matt Campbell
Matt Campbell
9,767 Points

WordPress is a PHP framework. It is written in PHP as well as the other languages. What WordPress has is a tonne of functions and hooks written into it so that you can just write the_content() or something and it will get the function that relates to that callback.

If we didn't have these functions, we'd have to write a mySQL query every time we wanted to get something from the database so it's just a cleaner, quicker and easier way to do that.

What I suggest is you jump on the PHP track and do that before delving into the depths of WordPress. If you're struggling with the basic WP functions, there's a lot more that will boggle your mind. You need a good understanding of foreach loops, arrays, variables and a few other bits and pieces the PHP track will teach you.

Brittany Cerra
Brittany Cerra
7,424 Points

Hey! Thanks for the response. I could do with a better understanding of PHP, but I know the basics that you mentioned....out of context where I defined my own variables/functions/objects.. In the context of Wordpress, I'm missing the link between Wordpress' s predefined code and my content.