Jump to content

Help pls with permalink..?


Taffy1957

Recommended Posts

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 !  :wtf:

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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..?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.