Title: Echo Statement
Last modified: August 19, 2016

---

# Echo Statement

 *  [jor133d](https://wordpress.org/support/users/jor133d/)
 * (@jor133d)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/echo-statement/)
 * Ok, I am probbaly going about this the wrong way but I need the DIV to be a link.
   The issue is, I issue the div class depending on the posts age:
 *     ```
       $link=the_permalink();
       $mylimit= 2 * 86400; //days * seconds per day
       $post_age = date('U') - get_post_time('U');
       if ($post_age < $mylimit) {
   
       echo ' <div class="post-BIG" onclick="location.href='.$link.'"> ';
       }
       ```
   
 * There is more but that explains everything. The link is not working. I don’t 
   know how to make do so. Does anybody with more php knowledge know a solution?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/echo-statement/#post-1383453)
 * Try..
 *     ```
       echo ' <div class="post-BIG" onclick="location.href=\''.$link.'\'"> ';
       ```
   
 *  Thread Starter [jor133d](https://wordpress.org/support/users/jor133d/)
 * (@jor133d)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/echo-statement/#post-1383456)
 * The weird thing is happening:
 * `http://localhost:8888/wordpress/?p=1 <div class="post-BIG-admin" onclick="location.
   href=''">`
 * That is the source, why in the world would the link show up before the echo statement?
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/echo-statement/#post-1383457)
 * Change this..
 *     ```
       $link=the_permalink();
       ```
   
 * For..
 *     ```
       $link=get_permalink();
       ```
   
 * The permalink echoes it’s value, get_permalink gives a return value (which you
   need for things like storing in variables)..
 *  Thread Starter [jor133d](https://wordpress.org/support/users/jor133d/)
 * (@jor133d)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/echo-statement/#post-1383459)
 * ah, thank you!
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/echo-statement/#post-1383461)
 * 🙂 You’re welcome.. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Echo Statement’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/echo-statement/#post-1383461)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
