Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

craigtommola on "Conditional Posts Loop based on Current User Can"

$
0
0

I have the idea of what I'm trying to accomplish, and I believe that it's feasible, but my lack of experience with PHP syntax is mucking it up. Here's the basics of it, without a lot of backstory.

I would like to modify this part of the loop:
<?php if ( have_posts() ) : ?>

To run conditionally if current_user_can('manage_links')

I tried a handful of attempts at if have posts AND user can manage links, but again I believe my syntax is incorrect.

If the user cannot manage links, I would like the loop to return the default message, which in my case is modified to be "You do not have permission to view this content."

Please lend your thoughts.

Thank you kindly
CT


Viewing all articles
Browse latest Browse all 8245

Trending Articles