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 How WordPress Plugins Work Examples of WordPress Actions and Filters

Should we put $content .=$social_content; on line 25 instead of $content .=$new_content; ?

Is there an error in a code example of how to append sharing content?

4 Answers

weal
PLUS
weal
Courses Plus Student 4,375 Points

I see this is an old question, but this small error still exists in the project files.
Please see 6:59 in the video.
$social_content is the variable with the content to add, but $new_content is used, which isn't defined.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hi, I don't think so, are you noticing an error?

There's no error, but once you add a plugin header and activate the code on WP 4.2.2, the plugin has no effect until you match up the variable names:

            $social_content = 'Insert in the social sharing code here';
            $content .= $social_content;    
liktid
liktid
6,387 Points

shouldnt this error be fixed after this long time? or when its not an error explained?

Just seen this, totally agree - this is an error surely? Concatenating $content with an empty $new_content would do nothing, and $social_content is left alone.

I'm assuming this is a couple of years old now, but this should be fixed, even just in the project download files with a quick note commented out in the PHP.