44 Responses

  1. The Frosty @WPCult
    The Frosty @WPCult July 1, 2009 at 11:38 pm |

    Totally simple! Love it!

    Reply
  2. Aaron
    Aaron July 2, 2009 at 6:55 am |

    Between your and Ian’s wonderful code tutorials, I might actually finish (and release) a proper child theme for Thematic.

    Thanks Justin!

    Reply
  3. Upper Fort Stewart | Daily Digest for July 3rd
  4. links for 2009-07-02 « Twan van Elk
  5. Replacing the “read more” link on your WordPress blog
  6. Webwinkel
    Webwinkel July 6, 2009 at 3:45 pm |

    @ Justin, the script above, using the_content_more_link filter hook, just works for WP 2.8 ?

    Reply
  7. David Zemens
    David Zemens July 6, 2009 at 8:39 pm |

    Thanks for the tip. Also remember that you can style your more-link text using the CSS class:

    .more-link {
    }
    Reply
  8. Ed
    Ed July 7, 2009 at 4:09 am |

    Justin, is it possible to have an image for this custom more link?
    And apply it to specific categories as well?

    Reply
  9. David Zemens
    David Zemens July 7, 2009 at 6:39 am |

    I don’t want to hijack any answer Justin might give, but you can have a background image attached to the .more-link CSS class and can easily apply a single image to the more link.

    Reply
  10. David Zemens
    David Zemens July 7, 2009 at 7:17 am |

    @Ed,
    As a followup, I used this PHP code to add a class to the container that the more link is in. By doing so you should be able to apply additional CSS markup to add a different background image based on the category ID number.

    cat_ID;	?>

    I think.

    Reply
  11. David Zemens
    David Zemens July 7, 2009 at 7:17 am |

    Sorry, the PHP code was stripped out of the post above. Let’s try it again:

    cat_ID;	? >
    Reply
  12. Ed
    Ed July 7, 2009 at 7:24 am |

    No problem at all David! :)

    So how would that alter the above code snippet Justin posted in his post as a whole?

    Like this?

    I don’t know exactly how to apply your suggestion to the code.

    Reply
  13. Ed
    Ed July 7, 2009 at 7:26 am |

    Ah crap, same thing happens to me now.

    Let me give it another shot:

    Reply
  14. Ed
    Ed July 7, 2009 at 7:28 am |

    Okay this is not going to work for me, I can’t post the code in a comment.

    Reply
  15. David Zemens
    David Zemens July 7, 2009 at 3:19 pm |
    $category = get_the_category(); echo $category[0]->cat_ID;

    I placed this code (contained withing the appropriate PHP tags) inside the container tag that the more-link was contained within. By doing this a unique container class can be generated depending on the category of the post.

    For instance, in my case it generated as such:

    as the 33 is the category ID of the category assigned to the post.

    Then, I suppose, you could use CSS to customize this class and serve up a different image for the more-link depending on the class.

    Make sense?

    Reply
  16. David Zemens
    David Zemens July 7, 2009 at 4:26 pm |

    @Ed

    http://www.1955design.com/_powerlink/

    At the example URl above, I have styled the “Read the full article” link just as I described above. The .more-link class can be styled as desired, and the PHP code that gets the current category can be used to specifically style a CSS container. The red bordered link is styled in such a way that only items in category 3 received the red border. In this same manner you could apply a background image to the link that would be different for each of your categories. I hope this helps.

    Reply
  17. Ed
    Ed July 7, 2009 at 5:12 pm |

    Hi David,

    Hmm, I’m still not sure how I need to use that line in combination with Justin’s code?

    Should I just add it under the second line?

    I’ve got the snippet here: http://snipt.net/Edwin/custom-more-link

    Reply
  18. David Zemens
    David Zemens July 7, 2009 at 6:13 pm |

    @Ed,
    That code needs to be hard coded into your index.php file, etc. so that it applies the unique class to the division that the more-link is located in. Make sense?

    Reply
  19. Ed
    Ed July 7, 2009 at 6:29 pm |

    @David,

    So I could basically add that line (Within the appropriate php tags) after the the_content template tag?

    Reply
  20. David Zemens
    David Zemens July 7, 2009 at 6:41 pm |

    Not really. It needs to be added to the CSS markup that controls the container that the more-link is located in. Are you familiar with CSS?

    Reply
  21. Ed
    Ed July 7, 2009 at 7:00 pm |

    @David,

    Okay, now you’re confusing me. :)
    The code line you posted surely can’t be posted in a CSS stylesheet?

    $category = get_the_category(); echo $category[0]->cat_ID;

    @Justin,

    Thanks for posting the code for the background image, I’ll check it out.

    Reply
  22. Theme Playground | Community Link Roundup: Everything’s for sale
  23. Jauhari
    Jauhari July 21, 2009 at 11:26 pm |

    My Question is..

    add_filter( 'the_content_more_link', 'my_more_link', 10, 2 );

    What for the 10 and 2 number above?

    Reply
  24. Shibi Kannan
    Shibi Kannan August 2, 2009 at 2:35 am |

    Very nice discussion going on here, I would like to see more creative uses for the custom more link – any ideas !

    Reply
  25. Keith Purkiss (Alex Jeffreys Student)

    Hi Justin,

    I’m finding a lot of useful stuff here.

    My homepage was getting a bit full so I’ve just edited a few posts and put in the
    tag to tidy it up a bit. I know there’s plugins that do something similar but this is so simple and you can choose where to put the tag to intrigue people – a bit like having a headline that makes them want to read more.
    Now I have a whole compact list a partial posts and I think it will get me more readers.

    Haven’t got as far as the advanced stuff yet ;)

    Reply
  26. Simon Wilby
    Simon Wilby August 11, 2009 at 12:57 am |

    I am using this one but not able to edit its style, like I want it to display in bold and underline.

    Can I change that on the stylesheet or in the functions.php itself.

    Reply
  27. David Zemens
    David Zemens August 11, 2009 at 6:33 am |

    @Simon;

    You should be able to add this class to your style.css file and style it accordingly:
    .more-link {
    }

    Reply
  28. kaos murah
    kaos murah September 7, 2009 at 10:29 am |

    My homepage was getting a bit full …yeah. but no problem

    Reply
  29. Tiago
    Tiago September 15, 2009 at 4:01 pm |

    Perfect! Just what I was looking for. Was able to hook it up on Thematic without any issues. Out of curiosity: what are the 10 and 2 numbers refering to?
    Thanks!

    Reply
  30. neel
    neel October 14, 2009 at 10:52 pm |

    Nice trick. i want to ask you can we apply filters in sidebar widgets. I want to change all links in sidebar and want to add affiliate id in front of all the links. can i do this using the filter . please let me know

    Reply
  31. Jaxov
    Jaxov October 26, 2009 at 7:53 am |
    Reply
  32. Cool Things You can do with the WordPress “more” Tag | Digging into WordPress
  33. Maxwell
    Maxwell January 28, 2010 at 3:27 pm |

    I’m starting to use more links too.
    But what if you have a nice beautiful image (say 640 X 480px) in your post and you still want that image (resized of course!) to be part of the entry so that you post isn’t just all text. For exaple, look at how Purse Blog (http://www.PurseBlog.com ) has nice small intros with a “Continue Reading” button, but the glamourous fashion product image is still part of the shortened post. How do I do that??

    I know some professional themes do that right off the bat. But is there a way to tell WordPress that you want the image in your post to also be part of the shortened entry?

    Thanks for the tips!

    Reply
  34. Alan
    Alan June 6, 2010 at 7:09 pm |

    Thanks very much! In particular, here’s how to append a right arrow to each cut, regardless of whether you’re using the default cut text or not:

    <?php
    add_filter('the_content_more_link', 'my_more_link', 10, 2);
    function my_more_link($more_link, $more_link_text) {
            return str_replace("", " →", $more_link);
    }
    ?>
    Reply
    1. Alan
      Alan June 8, 2010 at 7:03 pm |

      Oh, darn. that was supposed to be str_replace("</a>", " &rarr;</a>", $more_link)

      Reply
  35. Rehberi
    Rehberi June 22, 2010 at 10:42 am |

    Thanks for the tip! I am gonna try it right now!

    Reply
  36. Download evermore plugin and make readmore link | Techmazik
  37. yuzienborn
    yuzienborn December 11, 2010 at 8:14 pm |

    Thanks :) easiest time I’ve had changing that yet.

    Reply
  38. YetiMade
    YetiMade December 15, 2010 at 8:56 am |

    Hey, Thanks for this tutorial.

    I noticed though that when I use this “hook” it breaks my site. I’m using WordPress 3.0.2 and a child theme of 2010.

    I’m noticing that the function for twentyten_continue_read_link , if modified at all, crashes my entire site. Furthermore, when I use the code provided, I get similar results.

    Anyone else having this issue or know of a way to combat it?

    Thanks!
    YetiMade

    Reply
  39. Shubham Pandey
    Shubham Pandey December 10, 2011 at 3:17 pm |

    thanks Justin for that info… i am searching for this..its useful for me..

    Reply
  40. John Potter
    John Potter June 26, 2012 at 5:12 pm |

    I arrived here with the same question as Jauhari and Tiago about the numbers 10 and 2.

    The 10 is the filter priority and the 2 is the number of arguments, according to this page:
    http://blog.successbias.com/2010/10/06/wordpress-how-to-change-read-more-text/

    Reply
  41. Filmy poskie
    Filmy poskie September 23, 2012 at 12:31 pm |

    I have seen that right now, more and more people are attracted to camcorders and the discipline of digital photography. However, like a photographer, you have to first invest so much time period deciding the model of dslr camera to buy and also moving via store to store just so you could buy the cheapest camera of the brand you have decided to decide on. But it doesn’t end generally there. You also have take into consideration whether you should buy a digital photographic camera extended warranty. Thx for the good tips I acquired from your blog.

    Reply
  42. Activar el “read more” en Custom Page template | Enrique Acevedo

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.