How to Code something only for admin, and show in public area of site?

Hi,

I want to display a message in a plugin in public area of site, if admin is logged in,
and another message, if anyone else (other than admin) is logged in.

Can someone please give me idea or show me an example, how to code that ?
Thanks.

I think i have not provided enough info in question.

You can do something like:


<?php if(current_user_can('edit_users')) : ?>
Admin Message
<?php else : ?>
Normal Message
<?php endif; ?>

Hi, Thanks for your valuable information.

Sir, Can you please help me in one more thing, I need to get the value of a variable on top of the page, which is declared and defined in bottom of that page.

Declare it at the top? =p

You can’t use it until it’s declared, so you’ll have to move it.