<<<<<<< .mine ======= >>>>>>> .r525 <<<<<<< .mine ======= >>>>>>> .r525

Carrington



« | »

Remember Variable Scope

I’ve seen a few posts/questions asking why code from Theme X doesn’t work in a Carrington based theme. In some cases, the answer is fairly simple – the code is relying on global variables that aren’t available in the Carrington template being referenced.

The Carrington framework loads in template files within function calls, so if you need to access a global variable, you need to declare it as global first.

For example:

echo $post->post_author;

might not work in a certain template, but this should:

global $post;
echo $post->post_author;

Posted by Alex King on June 29, 2009.

Categories: Development

No Responses Yet

Leave a Reply

« | »




Recent Posts


Pages



About Carrington

Carrington is a theme platform for WordPress from Crowd Favorite. It includes the Carrington Core, a reactive templating engine that makes it easy to create different visual styles for different site areas and content and Carrington Build, an advanced drag and drop page layout system that enables full editorial control for complex pages. more →
← Exit Carrington Mobile Preview