The MU forums have moved to WordPress.org

php the_permalink in Javascript (2 posts)

  1. mrarrow
    Member
    Posted 14 years ago #

    Hi, I guess slightly off topic, but I need to construct a variable in Javascript, so that when clicked it opens up the relevant WP post. The variable needs to be the following familiar line:

    '" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>'

    I've got the rest of the code in place, but am just struggling with this last bit.

    Any help much appreciated!

  2. mrarrow
    Member
    Posted 14 years ago #

    Sorry, it mangled the code - should've been:

    <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>

About this Topic