WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the CubePoints plugin that rewards users with 1000 points via the following function:

if( function_exists(‘cp_alterPoints’) && is_user_logged_in() ){
    cp_alterPoints(cp_currentUser(), 1000);

Now, I would like to reward a user 1000 points for viewing one specific custom page that I created with with a page template.
Lets call it landingpage.php and the post ID of this page is 24122.

Is there any way to accomplish this?
Something like "if is page landingpage" (or "if is post=24122"), then perform the above function.

share|improve this question

Have a look at the is_page() conditional tag and at conditional tags in general.

is_page() takes both post IDs as well as slugs (and more) as arguments, hence you can choose how you'd like to identify the page in question.

With the above given ID, this, for instance, ought to work:

if( function_exists('cp_alterPoints') && is_page(24122) ){
    cp_alterPoints(cp_currentUser(), 1000);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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