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! While you're at it, check out some resources Treehouse students have shared here.

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

WordPress How to Build a WordPress Plugin Building a WordPress Plugin Settings Page Basic Markup for WordPress Settings Pages

What's Wrong With This Code?

Hey TreeHouse Masters,

Can't get the images to show up with this code. I have the wp-badge.png in the images folder but no showy up?

Thanks in advance!

<!-- BADGES POSTBOX -->

                <div class="postbox">

                    <div class="handlediv" title="Click to toggle"><br></div>
                    <!-- Toggle -->

                    <h3 class="hndle"><span>Most Recent Badges</span>
                    </h3>

                    <div class="inside">     
                        <p>Below are your most recent badges.</p>


                        <ul class="wptreehouse-badges">
                            <?php for( $i = 0; $i < 20; $i++ ): ?>
                            <li>
                                <ul>
                                    <li>
                                        <img class="wptreehouse-gravatar" width="120px" src="<?php echo $plugin_url . '/imgages/wp-badge.png'; ?>">
                                    </li>
                                    <li class="wptreehouse-badge-name">
                                         <a href="#">Badge Name</</a>
                                    </li> 
                                    <li class="wptreehouse-project-name">
                                        <a href="#">Project Name</a>
                                    </li>
                                </ul>
                            </li>
                            <?php endfor; ?>
                        </ul>

4 Answers

I think you spelled your images' directory wrong (imgages) when you try to echo the src value.

You also have a syntax error with closing the link for "Badge Name". < / < / a >

Thanks Jeff, that was the problem.

Hey Jeff,

What do you think is wrong with this code?

It is from the exercise.

<?php

// Handle: my_plugin_css // Plugin folder: my-plugin // CSS file: my-plugin.css

function my_plugin_styles {

wp_enqueue_style( 'my-plugin_styles', plugins_url( 'my-plugin/my-plugin.css' ));

} add_action( 'admin_head', 'wp_plugin_styles' );

?>

Copied for formatting:

<?php
// Handle: my_plugin_css // Plugin folder: my-plugin // CSS file: my-plugin.css

function my_plugin_styles {
    wp_enqueue_style( 'my-plugin_styles', plugins_url( 'my-plugin/my-plugin.css' ));
} 
add_action( 'admin_head', 'wp_plugin_styles' );
?>

My account is paused right now so I can't go in to test things, but I think you used the wrong Handle in your function. In the commented-out line at the top, it says "Handle: my_plugin_css". But in your function, it looks like you used "my-plugin_styles".

Thanks so much Jeff!