screenm0nkey
screenm0nkey

Reputation: 18795

Underscore before theme name

I was browsing the template.php file for the rootcandy theme and noticed some of the function names start with an underscore i.e.

function _rootcandy_admin_links()

function rootcandy_body_class()

Anyone know why this is? I thought the functions had to start with the name of the theme.

Many thanks

Upvotes: 2

Views: 562

Answers (2)

marcvangend
marcvangend

Reputation: 5642

What SamB says, and also: functions in template.php only have to start with the theme name if they are meant to override an existing theme function. For example, when overriding theme_foo($variables), you use mytheme_foo($variables) in the template.php of the 'mytheme' theme. It's perfectly okay to add your own functions, like calculate_some_value() or _calculate_some_value(), if that helps you code your theme.

Upvotes: -1

SamB
SamB

Reputation: 9224

Conventionally, underscores at the beginning of identifiers mean "This is private/internal stuff. You probably don't want to mess with it from other modules."

Upvotes: 3

Related Questions