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 trialLuke Wenke
32,294 PointsCode Challenge: How to Create a WordPress Shortcode
"Inside of the my_plugin_shortcode function, pull in the global post variable. Then extract the num_courses attributes, setting it to a default value of four."
Hi it gives the following error:
Bummer! extract should be passed the return value of shortcode_atts directly.
<?php
function my_plugin_shortcode( $atts, $content = null) {
global $post;
extract ( shortcode_atts( array('num_courses' => '4'), $atts) );
}
?>
2 Answers
Zac Gordon
Treehouse Guest TeacherCheck the spacing after the extract function
Luke Wenke
32,294 Pointsok I got rid of the space after the extract function call.... it looks like the wordpress coding standards say not to have a space there... http://make.wordpress.org/core/handbook/coding-standards/php/