Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Martin Graulund Larsen
26,279 PointsWordpress Theme Option page
Hi,
I have a problem with this code:
function register_my_custom_menu_page() {
add_menu_page( 'Slim option', 'Slim option', 'manage_options', get_template_directory_uri() . '/assets/admin/theme-admin.php', '', get_template_directory_uri() . '/assets/img/icon.png', 99 );
}
add_action( 'admin_menu', 'register_my_custom_menu_page' );
I am working local with Mamp and i get this output: http://localhost/localhost/slim/wp-content/themes/slim/assets/admin/theme-admin.php
I use the same method with all my css files with out any problems.
4 Answers
Andrew McCormick
17,730 PointsI've never seen it do that before. Is it outputting the same when you call it the second time for you .png file?
have you tried using get_stylesheet_directory_uri() instead just to see what you get (assuming you don't have child theme for this theme active)

Martin Graulund Larsen
26,279 PointsI have tried with it too, with the same result. I think maybe it's something with my MAMP settings.

Jon W
6,185 PointsHave you tried not using get_template_directory_uri() at all and just use the relative path?
Is this code in functions.php or a plugin folder?

Martin Graulund Larsen
26,279 PointsThe relative path goes til wp-admin/.
This is in functions.php