I'm trying to conditionally display some content in a theme using custom roles and capabilities. First, I define a custom role:
add_role('free_vendor', 'Free Vendor Listing', array('read', 'edit_posts', 'delete_posts', 'display_map'));
This is run directly from functions.php (do I need to add it to an action somewhere?)
Then I use the
display_map capability I defined to conditionally display the map:
if (author_can($post, 'display_map')) echo '<li><a href="#map">Map</a></li>';
The only problem is, it doesn't work! Is there some issue in using author_can() with custom post types? Am I not calling add_role() properly? I can't really find any decent documentation on using
author_can() with anything other than vanilla posts. Is this just not possible?