Customizr comes with a default comment bubble using a font icon and displaying the number of comments next to each posts. (see below)
You might want to change this and add specific content and/or a custom style. This snippet will show you how to do it and get something like shown below :
PHP code
In the following example, I simply apply a filter to the core bubble rendering which adds the text “comment” (with a WP plural filter function __n).
add_filter('tc_bubble_comment' , 'my_custom_comment_buble'); function my_custom_comment_buble() { if ( 0 == get_comments_number() ) return ''; return sprintf('<span class="my-custom-bubble">%1$s %2$s</span>', get_comments_number(), sprintf( _n( 'comment' , 'comments' , get_comments_number(), 'customizr' ), number_format_i18n( get_comments_number(), 'customizr' ) ) ); }
Where to copy/paste this code? => in your functions.php file. We strongly recommend you create a child theme. Download a start-up child theme here.
Remember: you shouldn’t edit the theme’s functions.php.
See How to customize the Customizr WordPress theme for more information on how to set up a functions.php file in a child theme.
CSS Code
.my-custom-bubble { position: relative; bottom: 28px; right: 10px; padding: 4px; margin: 1em 0 3em; border: 2px solid #F00; background: #FFF; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; font-size: 10px; color: #F00; } .my-custom-bubble:before { content: ""; position: absolute; bottom: -14px; left: 10px; border-width: 14px 8px 0; border-style: solid; border-color: #F00 rgba(0, 0, 0, 0); display: block; width: 0; } .my-custom-bubble:after { content: ""; position: absolute; bottom: -11px; left: 11px; border-width: 13px 7px 0; border-style: solid; border-color: #FFF rgba(0, 0, 0, 0); display: block; width: 0; }
Source : http://www.sitepoint.com/pure-css3-speech-bubbles/
Hope you’ll enjoy this little snippet and as always your comments/improvements are more than welcome!
19 thoughts on “Custom comment bubbles in the Customizr WordPress theme”
Hi! I am trying add this feature to the current version of Customizr, but i do not get it to work.
Could you help me? I tried the custom css but that did not do anything, greetings, David
Hello there! I am not exactly sure what to do with mine, I am using Tempera theme, and whenever I do the instruction it just have a “Post a Comment” option. Please help!
Hi,
I added the code in child functions .php. Now Im able to style the speech icon to my liking but can you please tell me what to remove in the code so as i dont get the word “comments”. I just want the number to be displayed.
Thamk you!
Got it done. Explain in the previous reply to elabayor.
Hi there, I have a question regarding comments bubble. My site is set in Polish and everything is polish, only in comments bubble is says f.e. “1 comment” as it is, in English. How to change it for Polish?
HI elabayor!
I know its very late to reply 🙂 But doing it for the sake of others. Firstly I want to admit I don’t kno php scripting, i still learning. Hope this would help.
http://pastebin.com/4j6qT3A7
Hi Nicolas
Firstly, I have just changed to your theme and am really impressed. Great work! However I have a rather dumb question. I want to remove the sentence under the comments box (as per the above query from Lite) “You may use these HTML tags and attributes”. I have been on the support forum for the theme and got a very prompt response to my question which said I should insert the following into the Custom CSS in my Child theme.
.form-allowed-tags {
display: none;
}
My questions:
Do I have to use a Child theme, OR
Could I past it into the box in Customize-Custom CSS-Add you custom CSS here?
All this is new to me so some guidance in non-tech speak would be great! Many thanks
Hi Tony and thanks for this comment.
You can do both : paste this CSS code in your style.css file of your child theme OR in the Custom CSS field.
There’s actually a good php alternative way to remove those comment. It’s described here : http://www.presscustomizr.com/snippet/removing-the-allowed-html-tags-note-after-the-comment-form/
Hope this will help.
Hi Nicolas & Lite
Thanks for the rapid response. I do not appear to have an “Editor” selection in Appearance so I am going to go the Custom CSS route.
I have also vowed to teach myself HTML and to download a child theme and start learning how to make some of the changes I have been reading about on your site.
I spent soooo long trying to figure this out, and the more you look the more confused and know you got no idea what to do when trying to find out what on earth to do to get rid of it, FINALLY I found the solution ( for me anyhow ) I am the least technical minded / code person there is, I don’t understand any of that code stuff or what it means or what to do with it etc, however I found out if I do this it got rid of it
1) in wordpress – go to “appearance”
2) select “editor”
3) then on the right amoungst all that mumbo jumbo stuff – see something called “Styles” and under that it says stylesheet (style.css)
4) click on where it says stylesheet (style.css)
5) then in the main area after it chances to that “Customizr: Stylesheet (style.css)” as the heading
6) what I then did is in that area with all that code stuff, go ALL THE WAY TO THE VERY BOTTOM – because I had no idea what any of that was or what it does etc, so I went to the very bottom to the last of the very last code things and then make space by hitting the enter key on the keyboard so to add space after the last of the code, then I copy and paste the following to the very bottom
*/
.form-allowed-tags { display: none; }
7) click the button below all that code area beneath it where it says “Update File”
8) go check your web site now because YAY IT WORKS ! ! ! 😀 😀 😀 HAPPY ME ! !
9) don’t ask me what it is or what it does or how it works or how it does it or anything like that as I don’t know any of that stuff, but what I do know is by some miracle it solved the problem
10) good luck, I hope this helps you as this is a problem it seems everyone is having in trying to get rid of that message
Thanks for sharing Lite!
You may use these HTML tags and attributes:
HI Lite,
This is the default text displayed after the comment form. You can easily take control of it by using the filter : comment_form_default_fields which takes the array of fields as parameter.
How to use filters and actions hooks in WordPress?
More documentation about this filter here : https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/comment-template.php#L2071
Cheers
what does all that mean though ? I don’t understand all this technical jargon, I don’t understand all this code stuff,
I herd from someone else there was something they said about something in a comment.php thing, I found my comment.php thing in an editor area, it has this
does any of this mean anything to you ?
I still don’t know / understand what it is you are trying to tell me to do
<?php echo apply_filters( 'comment_separator', '’ ); ?>
__( ‘Leave a Comment’ , ‘customizr’ ),
);
comment_form($args);
?>
Hi Lite, as I explained before, the best way to remove this text below the comment form is to use the WordPress filter named : comment_form_default_fields. There are probably other ways to do it, like always in programmation.
Best
how do you remove the
You may use these HTML tags and attributes:
Hi Lite, what exactly do you need to remove?
would like to remove all this from the area under comments in post pages
You may use these HTML tags and attributes:
so what does all that mean ? what do I need to do ? what do I do in order to get rid of it ?