WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi this may look a little silly question but can someone let me know where is the location for theme_path? is it inside my own theme or very top level of the directory?

'menu_icon'  => theme_path . '/images/product-icon.png', 

A: www.awebsite.com/images/product-icon.png
B: www.awebsite.com/wp-content/themes/mytheme/images/product-icon.png

share|improve this question
up vote 2 down vote accepted

It's not entirely clear what you are referring to here. Judging from your code theme_path looks like a constant.

Usually when supplying/printing links to theme assets you would use get_bloginfo('key') with one of the keys template_directory or stylesheet_directory. Basically the latter will point at the child theme and the first to the parent theme if you are using a child/parent setup. Otherwise they are identical. Alternatively you could use get_stylesheet_directory_uri() or get_stylesheet_directory_uri() which behaves the same way.

In any case, they will return http://www.yoursite.com/path/to/wordpress/wp-content/themes/your-theme/, and you are responsible for appending the path with '/images/product-icon.png' or whatever is appropriate. Thus, alternative B in your question is correct.

One side note: WordPress generally uses the terms uri or url when referring to content your browsers will load, and the term path when referring to files on the servers local file system (i.e. resources that WordPress/PHP will load in itself).

share|improve this answer
Thanks Simon, what I am trying to do is creating a "Custom Page Type" and setting a menu_icon for that.As you know I am registering the page in function.php page, so what should I do now? – Behseini Jan 29 '13 at 8:13
Change the line in your example into 'menu_icon' => get_stylesheet_directory_uri() . '/images/product-icon.png' and it should workout fine, given that you have directory called images inside your theme holding the file product-icon.png. – Simon Jan 29 '13 at 8:16
Thanks Simon it works now – Behseini Jan 29 '13 at 8:23
Glad I could help! – Simon Jan 29 '13 at 8:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.