• jor133d

    (@jor133d)


    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)
  • Try..

    echo ' <div class="post-BIG" onclick="location.href=\''.$link.'\'"> ';

    Thread Starter jor133d

    (@jor133d)

    The weird thing is happening:

    https://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?

    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

    (@jor133d)

    ah, thank you!

    ?? You’re welcome.. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Echo Statement’ is closed to new replies.