the_title() The following...">

Dumping double quotes (PHP)

I want to avoid double quotes from this line:

<li><a href="the_permalink()">the_title()</a></li>

The following works great:

echo '<li><a href="';
echo the_permalink();
echo '">';
echo the_title();
echo '</a></li>';

... but how can I get them all in one ad?

thanks

+5
source share
6 answers
echo '<li><a href="', the_permalink(), '">', the_title(), '</a></li>';
+6
source

, , , the_permalink() the_title() , . get_permalink() $post- > post_title. , get_permalink() ($ post- > ID) . , , Wordpress (. .)

, . , , .

, :

echo ' this should be before the link: '.the_permalink().' But it is not.';

. :

http://example.com this should be before the link: But it is not.

PHP . HTML, , , , HTML, .

, :

echo '<li><a href="'.get_permalink($post->ID).'">'.$post->post_title.'</a></li>';

, , , . ( )

echo "<li><a href=\"".get_permalink($post->ID)."\">".$post->post_title."</a></li>";

, , , , .

+10
printf( '<li><a href="%s">%s</a></li>', the_permalink(), the_title() );
+2

( ):

echo '<li><a href="'
 . the_permalink()
 . '">'
 . the_title()
 . '</a></li>';
+1
echo "<li><a href=".the_permalink().">".the_title()."</a></li>";
0

<?php the_title_attribute() ?>. . the_title(), "" , HTML ( ) .

0

All Articles