WordPress.org

Ready to get started?Download WordPress

Forums

<!--More--> URLs aren't linking to actual article. (9 posts)

  1. bittbox
    Member
    Posted 7 years ago #

    I want my "read the rest of this article >" links to take my users to the actual story URL. Right now when you visit my blog, and click on a "more" link it takes you to a URL that looks like this:

    http://www.bittbox.com/illustrator/17-tips-that-will-save-you-time-in-illustrator/#more-164

    when the article URL is:
    http://www.bittbox.com/illustrator/17-tips-that-will-save-you-time-in-illustrator/

    This is quickly becoming a problem because social bookmarkers are bookmarking my articles at multiple URLs.

    Please help!

  2. lelion
    Member
    Posted 7 years ago #

    I don't know a solution for that.

    A plugin? Manual edit of some WordPress core file?

    I'd like to know how to achieve this, too!:-)

  3. 4k
    Member
    Posted 7 years ago #

    If you go to Options>>Permalinks you can set how you want your permalinks saved.

  4. textheavy
    Member
    Posted 7 years ago #

    I poked around in the editable options and I don't seen any way to configure the URL that the "more" link creates. But aren't you just using the Permalink URL in this case?

    All you have to do is use the Permalink code, preceded by some custom text:

    "Click here to read the rest of <?php the_title(); ?>" should render as "Click here to read the rest of Post Title"

    It seems to me that the "More" link is behaving correctly. It is sending readers to the Permalink article, but then skipping past the content they've already seen, so that they don't have to scroll down to get to what they want to see.

  5. textheavy
    Member
    Posted 7 years ago #

    Oh, I guess my suggestion above wouldn't work, because the PHP THE_TITLE code probably only works for the post it is currently in...I don't know.

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    This is not changable without hacking the core files.

    Specifically, you need to change get_the_content() in post-template.php. There, you will find a line similar to this:
    $output .= ' <a href=\"'. get_permalink() . \"#more-$id\\" class=\\"more-link\\">$more_link_text</a>\";

    (this forum screws up the \ marks, ignore those)

    Change that line by removing the "#more-$id" text, and you're good to go.

  7. bittbox
    Member
    Posted 7 years ago #

    post-template same as post.php?

    EDIT:

    I found this function in: wp/includes/template-functions-post.php

    but I removed the text like Otto said and it didn't work. Still getting redirected to the post URL with /#more-164 at the end.

    Is this something that should be effective immediately, or should I give it some time to set in?

  8. bittbox
    Member
    Posted 7 years ago #

    Otto, you rock. First of all, I'm an idiot, and the post-template.php file was there, i just didn't see it at first.

    I removed #more-$id, leaving "\" where it was, and it worked PERFECTLY!! I'm glad this was a quick fix, instead some ugly plugin i would have had to use.

    Thanks again.

  9. lelion
    Member
    Posted 7 years ago #

    Nice to see there's a workaround:)

    As to the...

    I'm glad this was a quick fix, instead some ugly plugin i would have had to use.

    ..I wouldn't say a plugin would be an ugly way of doing this:-) Because next time you upgrade, you'll have to:

    1) save the changes to the code of post-template.php somewhere,
    2) upgrade wordpress, by deleting old WP files (including post-template.php)
    3) edit manually again post-template.php so as to include the fix you need,

    and this will happen every time you make an upgrade;)

    A plugin, on the other hand, would make things much easier - upgrade, reactivate plugin, and do not edit core files:)

    But I do not know how easy/hard is to make this using a plugin - I am not strong in programming, unfortunately...

    For now, I have to make only one change when I upgrade - to the file wp-db.php in /includes, because MySQL on my host uses Latin-1 or something of the sort as default encoding for interaction with php scripts, and as I use UTF-8 in my blog, to make characters display correctly both in the database and in my blog, I have to add
    mysql_query("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci'");

    in wp-db.php, otherwise things go quite messy:(

    (You may refer to this thread for more info:)

    And I'm dreaming one day to find an easy way to modify wp-db.php using a plugin instead of manual edit, but I guess this is quite complicated...

    Cheers:)

Topic Closed

This topic has been closed to new replies.

About this Topic