"Leave reply" –> graphics

  • Luko

    #2722

    Hy,

    Is there any way to replace the “Leave replyt” text in the bottom of the post with some graphics (image)?

    Something like this: http://www.kuglanje.net/wp-content/uploads/icons/koment.jpg

    I guess I have to fiddle with php and that’s bad idea for me 🙂

    Does anyone did such things?

    Prasanna SP

    #21645

    Add this to your child theme’s functions.php file

    <?php

    function graphene_filter_gettext( $translated, $original, $domain ) {
    $strings = array(
    'Leave reply' => '<img src="graphics or image URL">',
    );
    if ( ! empty( $strings[$original] ) ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
    }
    add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );

    ?>

    Replace graphics or image URL with the URL of the image you want to use. I don’t know whether it is a good solution or not. But I’ve tested this in my test site and it’s working here – http://test3.prasannasp.net/

    I highly recommend not to test this in a fully configured working site. If anything goes wrong, you may lose your customers/readers due to a downtime..

    Luko

    #21646

    Working 🙂

    Am I understand this correct:

    PHP code above removes “Leave reply” text with html (img src) code?

    Can I do the same thing with “1 comment” and “%s comments”?

    Damn… I have to learn that PHP better, you can really do magic with it :)!

    Thanks for great answer!

    Luko

    #21647

    Right…

    It’s working in localhost, but…

    I do exact the same thing and getting WSOD in admin mode after updating file in editor.

    Getting this:

    Warning: Cannot modify header information – headers already sent by (output started at …/public_html/wp-content/themes/graphene-child/functions.php:1) in /…/public_html/wp-includes/pluggable.php on line 866″

    I have this in pluggable.php (line 866):

    “header(“Location: $location”, true, $status);”

    There is NO white space in childpage/functions.php code.

    Live site looks OK.

    http://www.kuglanje.net

    Any ideas?

    Luko

    #21648

    Looks like I figured it out. I put the code manually (type it), in Notepad++, convert to ANSI, revert to UTF-8, open the admin/editor, copy-paste the code from Notepad++ to admin/editor in EMPTY functions.php

    I assume that I have some encoding issues. I guess.

    Anyway,

    working now…

    http://www.kuglanje.net

    Prasanna SP

    #21649

    Bravo! 🙂

    I like that idea of using for no comments, and for posts having comments..

    Prasanna SP

    #21650

    I’m looking for even tighter code.. Will let you know if I find any..

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

You must be logged in to reply to this topic.

Do NOT follow this link or you will be banned from the site!