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 Connecting WordPress Plugins with 3rd Party APIs Parsing JSON Code Challenge: Part 2

sondus zatar
sondus zatar
8,604 Points

Using the JSON feed in the comments and the existing loop, echo out each of the course names inside the list items.

<?php if( $my_plugin_profile->{'badges'}['url'] == $my_plugin_profile->{'icon_url'} ): ?>

<li class="WordPress Plugin Development">
<? php echo $WordPress Plugin Development-> {'badges"}[$iP]->{"name"}; ?></li> <li class="WordPress Theme Development"> <? php echo $WordPress Theme Development-> {'badges"}[$iP]->{"name"}; ?></li> <li class="Introduction to PHP">
<? php echo $Introduction to PHP-> {'badges"}[$iP]->{"name"}; ?></li>

where is the wrong ?

1 Answer

James Oh
James Oh
39,169 Points

This seems to have worked for me:

<?php for( $i = 0; $i < count($my_plugin_profile->courses); $i++ ): ?>
  <li>   
    <?php echo $my_plugin_profile->{"courses"}[$i]->{"name"} ?>
  </li>
<?php endfor; ?>