Copy blog post title in more-link and comment field heading

Community Forums Forums Design Tips and Tricks Copy blog post title in more-link and comment field heading

This topic is: not resolved

This topic contains 6 replies, has 2 voices, and was last updated by  David Chu 9 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #51286

    lucaswijntjes
    Participant
    Post count: 8

    Hi there,

    I’m looking for a function that copies the title of a blog post in two specific elements:

    1. The more-link after a post excerpt, for example: Continue reading “Random Blog Title”
    2. The heading above the comment box, for example: Leave a reply for “Random Blog Title”

    Your help is much appreciated!

    #51295

    David Chu
    Participant
    Post count: 1184
    #51300

    lucaswijntjes
    Participant
    Post count: 8

    Thanks for your reply David. Seems like I’m getting closer

    The code for the comments link isn’t doing anything. I have a Dutch translation installed through the Genesis -Translations plugin. Should that affect anything?

    I’ve been trying the more-link, but can’t get it to copy the blogpost title. I have this:

    /** Customize Read More */
    add_filter( 'the_content_more_link', 'custom_read_more_link' );
    function custom_read_more_link() {
    	return '<a class="more-link" href="' . get_permalink() . '">Continue reading: get_the_title()</a>';
    }

    Thanks for your help

    #51306

    David Chu
    Participant
    Post count: 1184

    Lucas,
    Ah! Interesting. As it happens, this ends up being a WordPress, rather than a Genesis, question. And it has more of a standard WordPress answer. The doc example might work in a different context, maybe with the “..more” tag in the editor or something. I think this is what you want. I played with your wording just a little:

    add_filter('excerpt_more', 'custom_read_more_link');
    function custom_read_more_link() {
    	return '<a> ...Continue reading: ' . get_the_title() . '</a>';
    }
    

    Cheers, Dave


    David Chu · Custom WordPress Developer – likes collaborating with Designers

    #51309

    lucaswijntjes
    Participant
    Post count: 8

    David, you helped me find the answer. I used a combination of the two, which works perfectly:

    add_filter( 'the_content_more_link', 'custom_read_more_link' );
    function custom_read_more_link() {
        return '<a> Continue reading: ' . get_the_title() . '</a>';
    }

    Thanks a lot!

    Now I just need to find the solution for the comment box title. Any clue?

    #51318

    David Chu
    Participant
    Post count: 1184

    Hmmmm… that comment example is for the title above existing comments, not for the comment form.

    This is a bigger deal than I thought, and sorry, I don’t have the time to investigate now. Here’s some good reading on the subject.

    http://ottopress.com/2010/wordpress-3-0-theme-tip-the-comment-form/

    Good luck, Dave


    David Chu · Custom WordPress Developer – likes collaborating with Designers

    #51839

    David Chu
    Participant
    Post count: 1184

    Hi,
    As it happens, I found the answer for the Comment Box title while looking at something else. This is WordPress code, rather than being specifically for Genesis:

    add_filter( 'comment_form_defaults', 'dc_change_form_title');
    function dc_change_form_title($arg) {
    	$arg['title_reply'] = __('Leave a comment or whatever you want it to say');
    	return $arg;
    }
    

    It’s always a little trickier with arrays. :-) I have an extra “underline” there for translation, which brings up the point that one can also change these in the translation POT file, too, I believe.

    Cheers, Dave


    David Chu · Custom WordPress Developer – likes collaborating with Designers

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.