0

Here I hope is a simple question for a php newbie. I have a textbox on my blog's home page that contains a link to another page. Should the visitor click the link and go to that page, I want to be able to check to see if the user is there so I can change the text and CSS.

I know how to use the ishome() function, but what function do I use to check if the user is on the page in question? It's not a post, just the mysite.com/what-we-do page.

Thanks.

3
  • 1
    Not I've understood, but maybe you need is_page
    – gmazzap
    Commented Nov 14, 2013 at 19:13
  • If you want to change something depending if a user is logged in you could use the is_user_logged_in_() function
    – Howdy_McGee
    Commented Nov 14, 2013 at 19:18
  • Yes, I did use is_page and that worked like a tee. Thanks.
    – user42760
    Commented Nov 14, 2013 at 20:05

1 Answer 1

1

It's not a post, just the mysite.com/what-we-do page.

Refer to is_page().

<?php
if ( is_page( 'what-we-do' ) ) {
    // We're on the What We Do page
    // do something
}
?>
1
  • And is there a way to go back to the referring page?
    – user42760
    Commented Nov 14, 2013 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.