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

PHP

Question on PHP code

Hi,

Anybody can help me with this block of code? I' m still learning php, and this is for wordpress.

How do i add another post id "1221" into this block of code for the same function as post 425?

$additional_classes[] = ( is_object( $main_topic ) && 425 != $post->ID && !is_singular( $Theme->News->post_type ) ) ? 'term-' . $main_topic->slug : '';

Thanks in advance!!

2 Answers

Hi, anyway i have solve this already. I just realise i cant delete this post.

Just saying, that line of code could use some serious reformatting. That's wayyy too long for one line and makes it very tough to read.

I guess if you are just modifying it it's okay, but I wouldn't ever really want to write out a line like that myself