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

Ben Silvertown
Ben Silvertown
987 Points

Wordpress dynamic next post link?

Hey guys!

At the moment i've got my next and previous links on my WP working nicely pulling content from custom post types.

<li id="prev">
   <a href="<?php echo get_permalink(get_adjacent_post(false,'',false)); ?>">&#8592; Previous Project</a>
</li>
 <li id="next">
   <a href="<?php echo get_permalink(get_adjacent_post(false,'',true)); ?>">Next Project &#8594;</a>
</li>

However how would I grey out the button once it's on the final page? At the moment it's still clickable and just refreshes the page which is abit confusing as although it's the last post it feels like something isn't working.

Ben