Hi!
I'm working on a little thing for my website (modifying an existing wordpress plugin, so that I can style the comments from the authors even if they post on facebook on the comment in the posted on wordpress via the plugin).
My code (working) is awful :
function Comment_class($classes) {
global $comment;
if (!empty($comment) && $comment->comment_agent == 'AL2FB')
$classes[] = 'facebook-comment';
if (!empty($comment) && $comment->comment_agent == 'AL2FB' && esc_attr($comment->comment_author_url) == 'http://www.facebook.com/profile.php?id=randomnumber1')
$classes[] = 'comment-author-ec';
if (!empty($comment) && $comment->comment_agent == 'AL2FB' && esc_attr($comment->comment_author_url) == 'http://www.facebook.com/profile.php?id=randomenumber2')
$classes[] = 'comment-author-ness';
if (!empty($comment) && $comment->comment_agent == 'AL2FB' && esc_attr($comment->comment_author_url) == 'http://www.facebook.com/profile.php?id=randomnumber3')
$classes[] = 'comment-author-alice';
if (!empty($comment) && $comment->comment_agent == 'AL2FB' && esc_attr($comment->comment_author_url) == 'http://www.facebook.com/profile.php?id=randomnumber4' || !empty($comment) && $comment->comment_agent == 'AL2FB' && esc_attr($comment->comment_author_url) == 'http://www.facebook.com/profile.php?id=randomnumber5')
$classes[] = 'comment-author-joannv';
if (!empty($comment) && $comment->comment_agent == 'AL2FB' && esc_attr($comment->comment_author_url) == 'http://www.facebook.com/profile.php?id=randomnumber6')
$classes[] = 'comment-author-kanata';
return $classes;
}
Here is my attempt :
function Comment_class($classes) {
global $comment;
if (!empty($comment) && $comment->comment_agent == 'AL2FB' && esc_attr($comment->comment_author_url) == $urlfacebook)
$classes[] = $facebookclasshere;
switch ($urlfacebook) {
case 'http://www.facebook.com/profile.php?id=randomnumber1':
$facebookclasshere = 'comment-author-ec';
break;
case 'http://www.facebook.com/profile.php?id=randomnumber2':
$facebookclasshere = 'comment-author-ness';
break;
case 'http://www.facebook.com/profile.php?id=randomnumber3':
$facebookclasshere = 'comment-author-alice';
break;
case 'http://www.facebook.com/profile.php?id=randomnumber4':
case 'http://www.facebook.com/profile.php?id=randomnumber5':
$facebookclasshere = 'comment-author-joannv';
break;
case 'http://www.facebook.com/profile.php?id=randomnumber6':
$facebookclasshere = 'comment-author-kanata';
break;
}
return $classes;
}
No idea why it's not working
Somebody could give me a hint? Thanks a lot !