Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Stephanie Leary

    (@sillybean)

    Got it to work. Here are the changes, if you’d like to incorporate them:

    line 35:

    // Customize this string if you want to modify the preview output
    	// %1 - author's name (as hyperlink if available)
    	// %2 - comment text
    	// %3 - gravatar image url
    	$previewFormat = '
    		<ol class="commentlist" style="clear: both; margin-top: 3em;">
    			<li id="comment-preview" class="alt" style="overflow: hidden;">';
    	if (get_option('show_avatars') != '0')
    		$previewFormat .= '<img src="%3" alt="" class="avatar avatar-' . $gravatar_size . '" width="' . $gravatar_size . '" height="' . $gravatar_size . '"/>';
    	$previewFormat .= '<cite>%1</cite> Says:
    				<br />
    				%2
    			</li>
    		</ol>';

    around line 200:

    if (get_option('show_avatars') != '0') $previewFormat = str_replace("%3", "' + gravatar + '", $previewFormat);

    Thread Starter Stephanie Leary

    (@sillybean)

    n/m, that worked in testing but removed the comment text in production.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    get_avatar does have the check built in. Look at the code in the default theme:
    <?php echo get_avatar( $comment, 32 ); ?>

    That’s all it takes in a theme.

    Live Comment Preview, on the other hand, is *live*. It’s generated via some other means, not via the PHP code.

    Thread Starter Stephanie Leary

    (@sillybean)

    I know. I just can’t seem to make it work. For now I’ve disabled the avatar in the CSS: #comment-preview img.avatar { display: none; }

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Live Comment Preview] Gravatars shown in preview even if turned off in blog settings’ is closed to new replies.