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

<ul> <?php for( $i = 0; $i < count($my plugin profile->courses); $i++ ): ?> <?php echo $WordPress Plugi

<ul> <?php for( $i = 0; $i < count($my plugin profile->courses); $i++ ): ?> <?php echo $WordPress Plugin Development->{'badges'}[$j]->{'name'}; ?> <?php endfor; ?> </ul>.

EDIT: Press edit and see what i did to achieve the highlighting on the code - Aurelian .

Hi, whats your answer anyways? it seem you just posted only a code . You should explain and ask a question us in detail. Pasting a code don't help us really . I can assume you have an error but i don't know .

sondus zatar
sondus zatar
8,604 Points

i dont know what is the wrong in my answer

<?php

/*
  {
    "name": "Username",
    "profile_name": "profile_username",
    "profile_url": "http://myapi.net/profile_username"
    "courses": [
      { "name": "WordPress Plugin Development" },
      { "name": "WordPress Theme Development" },
      { "name": "Introduction to PHP" }
    ]
  }
*/

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

```php

5 Answers

sondus zatar
sondus zatar
8,604 Points

what is the problem in my code?

I don't know , I'm just to start learning PHP.

sondus zatar
sondus zatar
8,604 Points

again , i tried this answer and not working

<?php

/* { "name": "Username", "profile_name": "profile_username", "profile_url": "http://myapi.net/profile_username" "courses": [ { "name": "WordPress Plugin Development" }, { "name": "WordPress Theme Development" }, { "name": "Introduction to PHP" } ] } */

?>

<ul> <?php for( $i = 0; $i < count($my_plugin_profile->courses); $i++ ): ?> <li>
<? php echo $WordPress Plugin Development-> {'badges"}[$iP]->{"name"}; ?></li> <li> <? php echo $WordPress Theme Development-> {'badges"}[$iP]->{"name"}; ?></li> <li> <? php echo $Introduction to PHP-> {'badges"}[$iP]->{"name"}; ?></li>

<?php endfor; ?> </ul>

Shai Yahav
Shai Yahav
7,153 Points

<?php echo $my_plugin_profile->{'courses'}[$i]->{'name'}; ?>

I would recommend to take some PHP basics course .