• Hi again bdbrown (or whoever answers) and thank you for your time,

    I searched www.remarpro.com as you said to see if I could find the solution to my problem, but the solutions listed did not work.

    I’m trying to add a simple “Read More” link after the excerpt on the home page (as well as on category pages).

    I thought it would work by simply clicking the “More” button when making a post, but it doesn’t then either. Nor does the changes suggested to others.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi thundersbe. Did you see this in the Codex? If you use that technique, and you’re using a child theme, you’ll also need to override the theme function:

    function child_theme_setup() {
      // override parent theme's 'more' text for excerpts
      remove_filter( 'excerpt_more', 'alx_excerpt_more' );
    }
    add_action( 'after_setup_theme', 'child_theme_setup' );
    Thread Starter thundersbe

    (@thundersbe)

    Well it still doesn’t work.

    I’ve got a child theme set up and I know it’s working because the css changes show up.

    I created a functions.php in the child folder and added:

    <?php

    function child_theme_setup() {
    // override parent theme’s ‘more’ text for excerpts
    remove_filter( ‘excerpt_more’, ‘alx_excerpt_more’ );
    }
    add_action( ‘after_setup_theme’, ‘child_theme_setup’ );
    ?>

    That’s literally all that’s there. Then I went in and clicked the “More” button, updated it…but it doesn’t work. I’m not surprised. Why does WordPress have to be so complicated. It’s like it doesn’t want to work like I want it to. Just show the dang read more link for Pete’s sake! Such a simple thing!

    Sorry, just frustrated.

    The relationship between the excerpt and the “more” tag can be confusing. By “excerpt” I thought you were referring to the either the automatically-generated excerpt or the manual Excerpt option below the post editor. The “more” tag only works when the WP function “the_content” is used to display the post preview. The Hueman theme uses the WP function “the_excerpt” which means:
    1. Check for a manual excerpt; if there is one use it
    2. Else look at the Excerpt Length set in Theme Options
    3. Then display the post content up the the length defined in that option
    4. Add “…” at the end of the excerpt

    By using the code from the Codex section I referenced, along with the child_theme_setup function I posted above, the “…” at the end of the excerpt will be changed to a “Read More” link to the full post.

    This functionality can be changed by editing the three content php files so they use “the_content” instead of “the_excerpt”. However, there’s an easier way to do this using a function. Take a look at this thread where we discussed a related issue and the function used there. It can easily be modified based on your specific situation. Let me know if you have any questions about the function or how to use it.

    Thread Starter thundersbe

    (@thundersbe)

    I’m sorry, but I’m not sure what parts of what you said are optional or a possible way or if they’re all tied together.

    Would you be willing to give me a step 1, do this. Step 2, do this, message?

    I’d prefer to just do it the simplest way.

    I’m sorry to cause you so much typing and really appreciate your help.

    So, assuming you want to create you own excerpts using the “more” tag, and you’ll use it on every post, you basically have are two options. Either (1) edit the 3 theme content files, or (2) use a function. The function is easier since all you have to do is add it and you’re done.
    1. Remove the “child_theme_setup()” function you added to your child theme functions.php file above.
    2. Go to Pastebin and copy that entire function to your child theme functions.php file.
    3. Remove this line from the function:

    * Modified so #1 above is not applied on the Home page

    4. Change these lines under #1:

    // Modified so not applied on the Home page
    if ( (! is_home()) && strpos( $post->post_content, '<!--more-->' ) && ! post_password_required() ) {

    by removing the // comment line and the “is_home” argument, so it looks like this:

    if ( strpos( $post->post_content, '<!--more-->' ) && ! post_password_required() ) {

    5. Then see if it works the way you want.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Read More Link’ is closed to new replies.