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 trialMark MacDermot
4,488 PointsIm stuck on challenge task 2 for How to create a Short Code for Word Press.
The first argument to shortcode_atts should be an array with num_courses set to the default value. I keep getting this! Can you point out what im doing wrong on this? I have been stuck on this the past hour.
<?php
function my_plugin_shortcode( $atts, $content = null ) {
global $post;
extract( shortcode_atts( array(
'num_badges' => '8',
'tooltip' => 'on'
), $atts ) );
if( $tooltip == 'on' ) $tooltip = 1;
if( $tooltip == 'off' ) $tooltip = 0;
$display_tooltip = $tooltip;
}
?>
1 Answer
Craig Watson
27,930 PointsHi Mark,
You may kick yourself for this one, just take a look at the name of your first att in your array?
num_badges
It is asking for it to be num_courses :)
Craig
Mark MacDermot
4,488 PointsMark MacDermot
4,488 PointsJust fixed it! Thanks for your help!