ThemeShaper Forums » Thematic

[closed]

Help editing the more link

(25 posts)
  • Started 1 year ago by cookieandkate
  • Latest reply from cookieandkate
  • This topic is resolved
  1. Hello! I've been trying to edit the text of the read more link (following the guidance provided at http://codex.wordpress.org/Customizing_the_Read_More), but I keep breaking my site. Rather than by default reading "read more", I'd rather it say "Continue to the recipe". How do I make that happen?

    I'd so appreciate your help!

    Kate

    Posted 1 year ago #
  2. just add this in your functions.php file

    // Puts link in excerpts more tag
    function new_excerpt_more($more) {
           global $post;
    	return '<a>ID) . '"> Read the full article...</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    Posted 1 year ago #
  3. oh i think you need something like this too

    function new_home_excerpts($content){
      if(is_home()) $content='excerpt';
    
      return $content;
    }
    Posted 1 year ago #
  4. Sorry, do I just copy and paste the second snippet of code right below the first?

    Posted 1 year ago #
  5. Right above, not inside the first snippet. Let me know if it works :)

    Posted 1 year ago #
  6. Well, I tried pasting your first bit of code followed by the next, and it broke my site! I guess that is not what I'm supposed to do.

    Posted 1 year ago #
  7. hmm ive done that before, dont know why it didnt work..

    Posted 1 year ago #
  8. Then I tried switching the order, and this also broke my site :(

    // Puts link in excerpts more tag
    function new_home_excerpts($content){
    if(is_home()) $content='excerpt';

    return $content;
    }
    function new_excerpt_more($more) {
    global $post;
    return 'ID) . '"> Read the full article...';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    Posted 1 year ago #
  9. looks like some of your excerpts are already what you want them to be, weird...

    Just wait for someone else more pro to help :P

    Posted 1 year ago #
  10. Yeah, I figured out how to edit the links manually for each post, so I could keep doing that if we can't standardize them all.

    Posted 1 year ago #
  11. ok, first "it broke my site" doesn't tell us much. if you put

    define('WP_DEBUG', true);

    in your wp-config.php file you will likely get something more helpful than white screen of death. in fact, it will probably (75% of the time) tell you what the error is. if Jagst3r15's code caused trouble it was probably a syntax error. you should always check that the code you get from here properly opens/closes all {}, (), ", etc... when you're done debugging you should probably switch it back to false.

    jagst3r15 was on the right path...

    this is how you get excerpts on your home page

    // Puts link in excerpts more tag
    function new_home_excerpts($content){
       if(is_home()) $content='excerpt';
       return $content;
    }
    add_filter('thematic_content','new_home_excerpts');

    and this is how you edit the read more link, straight from the codex:
    http://codex.wordpress.org/Function_Reference/the_excerpt#Make_the_.22read_more.22_link_to_the_post

    function new_excerpt_more($more) {
           global $post;
    	return '<a href="'. get_permalink($post->ID) . '">Read the Rest...</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    the order of these 2 functions is irrelevant.

    Posted 1 year ago #
  12. Thank you, Helga. You're right, I should have been more descriptive about the error message I received when my site went down. I'm sorry.

    I decided that customizing the more text link is easy enough to do within the post, so that is no longer my concern. However, even though my posts are showing up as desired (shortened versions) on my home page, I still see the full post in my feed. I want subscribers to only read up to the more link, and then have to go to the post itself (like they would if they were reading on my home page). Do you know how to make that happen? 101cookbooks.com is a prime example of how I'd like my more links and feed to function.

    Thank you for your help, it is so appreciated!
    Kate

    Posted 1 year ago #
  13. no problem. i have little experience with feeds but you could try changing the one function too

    // Puts link in excerpts more tag
    function new_home_excerpts($content){
       if(is_home() || is_feed()) $content='excerpt';
       return $content;
    }
    add_filter('thematic_content','new_home_excerpts');
    Posted 1 year ago #
  14. Thanks, Helga. That did something, but not what I wanted it to do, so I took the code back out. Here's a screenshot: http://imgur.com/NlxgQ

    I'm happy with the way my posts appear on my site, but I just want to cut the posts short at the point when I add the <!--more--> tag. I know it can be done because I see it on so many other wordpress sites, but I can't figure out how to make it happen! I've searched around in the codex and in the feedburner forums and can't find an answer. Do you have any other ideas?

    Posted 1 year ago #
  15. i'm not sure what i am looking at in the screenshot. like i always tell my designer, give me a hint.... don't make me try to guess what is wrong. you need both the new_excerpt_more() function AND the new_home_excerpts() function to get the [...] to be a permalink

    if you want to use the MORE tag then you have to serve up full posts, which is the thematic default on the home page anyway.

    how are you adding Print this post? what is the relevant code.

    Posted 1 year ago #
  16. Sorry, I don't think we're on the same page with what I'm trying to do. I do not want my posts cut off at any arbitrary point. I'm happy using the more link because I can insert it myself. The more links look just right on my home page now because I have manually inserted them. What I want is for the posts on my feed to cut off at the more link like they do on my home page now.

    PrintFriendly is just a plugin that I installed, then I used CSS to style the link:

    .printfriendly.alignright {
    margin: 0 0 10px 0 !important;
    display: inline-block;
    *display: inline;
    zoom: 1;
    vertical-align: middle;
    }

    Posted 1 year ago #
  17. you're right, i wasn't following you. i had no idea what i was looking at in that screenshot. anyway, like i said earlier... to use the <!--more--> tag you must be serving up full posts. this is the thematic default for the home page. if you want the feed to serve up full posts then you must filter thematic_content (like i've already shown) and adjust it so that $content = "full"

    function new_home_excerpts($content){
       if(is_feed()) $content='full';
       return $content;
    }
    add_filter('thematic_content','new_home_excerpts');

    again, i don't know much about feeds but that should do it.

    Posted 1 year ago #
  18. To be honest I don't understand why adding the more link function in your php file doesn't work. I have done it a hundred times. If you post your functions.php I will test it on my local machine and see what's up. use http://www.pastebin.com

    Posted 1 year ago #
  19. Hi Jagst, here's my functions.php: http://pastebin.com/iTqzyb7M. Thank you so much for offering to look at it. I can't seem to explain what I want to happen to Helga. Basically, my posts on my home page utilize the <!--more--> link now and look exactly the way I them to look. I just want my posts in my feed to cut off at the <!--more--> link instead of displaying the full post (and I want the post in my feed to include a link to the full post so subscribers can continue reading on my site). Thank you for your help!

    Posted 1 year ago #
  20. Kate, try this: http://pastebin.com/Jfn3qfPx . I added the three sets of code at the bottom.

    Posted 1 year ago #
  21. Hey Jagst, thank you so much for your help. I replaced my code with yours and unfortunately, it cut the text off short of my more tag and removed the images from the home page. I went back to my old code. Here's a screenshot of how it looked: http://imgur.com/NlxgQ

    Any other ideas? Thanks again,
    Kate

    Posted 1 year ago #
  22. Just remove this from the code I gave in the pastebin:

    // Define the excerpt length
    function custom_excerpt_length( $length ) {
            return 50;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

    I usually do things by trial and error since I'm not an expert, so I can't guarantee anything :P

    Posted 1 year ago #
  23. what do you get when you remove all the code we've been discussing in this thread? you said your home page was displaying correctly, but not the feed? did you try my last suggestion?

    Posted 1 year ago #
  24. Jagr, I tried that code, but it didn't quite give me what I want, either! http://imgur.com/BGr0J

    Helga, I've just been reverting to my old code after every attempt so my home page goes back to the way I want it to look. However, I just inserted your code and my home page still looks the same! My feed is still showing the full post, though, so it doesn't seem to have had any effect. Should I take it out?

    Posted 1 year ago #
  25. I found a solution and thought I'd post a link to it in case anyone else experiences this issue: http://www.peterrknight.com/how-to-truncate-your-wordpress-rss-feed-at-the-more-tag/. So glad to have that straightened out!

    Posted 1 year ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.