hello i have this;
echo'<h3 class="entry-title">'.get_the_title().'</h3>';
but how can i add a call for a permalink?
I tried
to split up the href tag such as
echo '<a href="' .the_permalink().'">click';
And a few other variants w/no success. Could i get some advice on this?
thx
m3g4p0p
December 30, 2015, 9:58pm
2
Did you try closing the <a>
tag?
m3g4p0p
December 30, 2015, 10:00pm
4
What exactly is the problem, then? If the_permalink()
returns a proper URL it should work just fineâŚ
it doesnât, that is why i wrote the topic.
this
echo'<h3 class="entry-title">'.the_permalink().get_the_title().'</h3>';
will return the link & title. great. but it is not clickable.
Other attempts like
echo'<href="'.the_permalink().'"> click me</a>';
will return a string like
http://agileart.us/arachnohazard/characters/devon-douglas/ click me
which is not a link. It is just text on the page
m3g4p0p
December 30, 2015, 10:12pm
6
In this case, you forgot to open the <a>
tag. Try
echo '<a href="' . the_permalink() . '">click me</a>';
2 Likes
Good catch i thought i had put it in. the click me does show, but so does the entire hyperlink.
m3g4p0p
December 30, 2015, 10:22pm
8
You mean, as in your previous reply? From that line alone, this canât be the case. Maybe you have echoed it somewhere before. Whatâs the preceding line, or the exact line youâve actually written for that matter?
noâŚthis is the code
'post_type'=>'characters',
'post_per_page'=>5,
'order_by'=>'rand'
);
$bookChars = new WP_Query($args);
echo'<div id="bookChars" class="bookChars">';
while ($bookChars->have_posts()):$bookChars->the_post();
echo'<figure class="bookCharsImgs">';
the_post_thumbnail('smallRatio');
echo'</figure>';
echo '<a href="' . the_permalink() . '">click me</a>';
echo'<h3 class="entry-title">'.get_the_title().'</h3>';
echo'<aside class="bookCharsAsides">';
the_excerpt();
echo'</aside>';
endwhile;
echo'</div>';
wp_reset_query();
m3g4p0p
December 30, 2015, 10:31pm
10
Actually, your old faulty line
echo'<href="'.the_permalink().'"> click me</a>';
shouldnât output
either, just âclick meâ. So if this is all your code,
the_post_thumbnail('smallRatio');
seems to return that URL. Otherwise I donât know. Try it with a hard-coded link and thumbnail and youâll see.
Yeah itâs weird. the click me actually goes no where. it stays on that page. it seems to bring back the hyperlink of the page it is on, even thought the code is correctly bringing back the thumbnail and excerpt.
Thank you though
D
ok in case this comes up in the future, this worked
echo "<a href='".get_permalink($post->ID)."'>Read More</a>";
m3g4p0p
January 3, 2016, 11:18am
14
Hahaha sorry I entirely missed that this topic was about WP! Dâoh!
system
Closed
April 5, 2016, 11:31pm
16
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.