0

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.

1 Answer 1

0

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);
}

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.