Is there a way i can get the_permalink as a variable? I need to build an info window with it but it wont appear in the $infoWindow variable…
<?
$link = the_permalink($post->ID); // prints out into html
$infoWindow = '<div><h2><a href="'.$link.'">'.$post->post_title.'</a></h2></div>';
?>
<script type="text/javascript">
marker = [<?=$v_latitude?>, <?=$v_longitude?>,"",'<?=$infoWindow?>'];
locations.push(marker);
</script>
best, Dc
Use
get_permalink()
instead. (Codex ref.)Per the WordPress function-naming convention, most functions have two forms:
the_*()
andget_*()
; thethe_*()
functions will print the output, and theget_*()
functions will return the output.