Taffy1957 Posted June 9, 2011 Share Posted June 9, 2011 Hi Guys, I'm sure this is simple for someone clued up on php coding, but no matter what I try, I cannot get it to work ! I have the following php code in my theme functions.php code sheet; echo " <a href='"; the_permalink(); echo "'>"."...Read More On "; the_title_shorten(45,'...'); echo "</a>"; This code creates a link to the full article from an excerpt on the home page, but the problem is, it is including the words "Read More On" in the hyperlink, which I feel is not good from a SEO point of view ! I would be very grateful if someone could show me how to rewrite this piece of code so that the "Read More On" would be printed as plain text & not be included in the hyperlink. Thanks Quote Link to comment Share on other sites More sharing options...
WebStyles Posted June 9, 2011 Share Posted June 9, 2011 If I'm not missing anything, that seems like it should work fine, unless the function the_permalink(); is also generating html code instead of just echoing a link. I would have a look at that function. remove everything else and just echo that function to see what it outputs. Quote Link to comment Share on other sites More sharing options...
Taffy1957 Posted June 9, 2011 Author Share Posted June 9, 2011 If I'm not missing anything, that seems like it should work fine, unless the function the_permalink(); is also generating html code instead of just echoing a link. I would have a look at that function. remove everything else and just echo that function to see what it outputs. Hi WS, No that code is wrapping the text (Read More On + Article Title) to form a hyperlink and what I want to try to do is move "Read More On" so that it gets printed as just plain text prior to the hyperlinked article title text. So I need to change from this - Read More On Asus Laptops To This - Read More On Asus Laptops I can manage it on here easy enough but I just can't seem to get that php code altered correctly so it will work..? Quote Link to comment Share on other sites More sharing options...
Ollifi Posted June 9, 2011 Share Posted June 9, 2011 Do you mean this: echo "...Read More On "; echo"<a href='"; the_permalink(); echo "'>"; the_title_shorten(45,'...'); echo "</a>"; Quote Link to comment Share on other sites More sharing options...
Taffy1957 Posted June 10, 2011 Author Share Posted June 10, 2011 Do you mean this: echo "...Read More On "; echo"<a href='"; the_permalink(); echo "'>"; the_title_shorten(45,'...'); echo "</a>"; Yes thanks so much Ollifi, that worked perfectly ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.