"Leave reply" –> graphics
-
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?
Add this to your child theme’s
functions.phpfile<?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 URLwith 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..
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!
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.
Any ideas?
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…
Bravo! 🙂
I like that idea of using
for no comments, and
for posts having comments..
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.
