Welcome to WebmasterWorld Guest from 54.225.31.78

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Can't find my error in PHP being written for Wordpress

I need a timed event to occur after a page is loaded

     
9:41 pm on Jan 10, 2014 (gmt 0)

10+ Year Member



I want an event to happen a short time after a wordpress page is loaded.

My function is in the custom page template.

In the code, I am using the time the page is loaded as part of the function name in case multiple instances of the page are opened.

(1) My page is not loading, which indicates to me that the code I am using is wrong, and

(2) I am wondering if this method will even work for what I want to do, which is to cause a message to be echo'd on screen after the visitor has been on the page for 60 seconds.

Any ideas on my code error, and any thoughts on a better method?

Many thanks!
CM
9:42 pm on Jan 10, 2014 (gmt 0)

10+ Year Member



Forgot to insert the code, and missed the edit button until I had posted this reply.

Here's the code.


<?php
$type = timestamp;
$time = current_time( $type, $gmt = 0 );
$timestamp = $time + 60 ;

function my_timed_function_$time(){ echo '<h1>POPUP</h1>'; // Do something. Anything.}

add_action('my_timed_action','my_timed_function_"<?php $time ?>"');
wp_schedule_single_event($timestamp,'my_timed_action');
?>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month