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
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 keystemplate_directory
orstylesheet_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 useget_stylesheet_directory_uri()
orget_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).