shoujohennagirl
asked on
.bypostauthor and .byuser not working in Wordpress
Hello,
Thank you for your time. I am making a wordpress theme, and testing it in xampp with wp 2.9.1, so I can't send you an actual link to the issue, but I will try to accomodate you in any way!
I want to make the user comments and the author comments pop out more, and am trying to use the .bypostauthor and .byuser in the css stylesheet.
However, when I style these, and check on the browser (checked Opera, Safari, IE, Firefox), there isn't any change. It doesn't mess up the comments. They look just fine. But the new styles just don't register.
Is there something I should be doing in comments.php? Is there something I missing?
I am attaching the code not only for my comments css, but also for comments.php
Thank you for your time. I am making a wordpress theme, and testing it in xampp with wp 2.9.1, so I can't send you an actual link to the issue, but I will try to accomodate you in any way!
I want to make the user comments and the author comments pop out more, and am trying to use the .bypostauthor and .byuser in the css stylesheet.
However, when I style these, and check on the browser (checked Opera, Safari, IE, Firefox), there isn't any change. It doesn't mess up the comments. They look just fine. But the new styles just don't register.
Is there something I should be doing in comments.php? Is there something I missing?
I am attaching the code not only for my comments css, but also for comments.php
CSS COMMENTS IN STYLESHEET
#respond p {
font-size: .9em;
}
#respond label {
margin: 5px 0 5px 0;
}
#comment {
width: 100%;
}
#commentform {
padding: 10px;
}
.thread-odd {
background-color:#F0CE87;
}
.commentlist li, #commentform input, #commentform textarea {
font: 0.9em 'Georgia', Times New Roman, Serif;
}
.commentlist li ul li {
font-size: 1em;
}
.commentlist li {
font-weight: bold;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #990000;
padding: 20px;
}
.bypostauthor {
color: #FFFFFF;
background-color: #000000;
}
.byuser {
color: #330066;
background-color: #E2ECF5;
}
.commentlist li .avatar {
float: right;
border: 1px solid #eee;
padding: 2px;
background-color: #FFFFFF;
}
.commentlist cite, .commentlist cite a {
font-weight: bold;
}
.commentlist p {
font-weight: normal;
line-height: 1.5em;
text-transform: none;
}
#commentform p {
font-family: 'Georgia', Times New Roman, Serif;
}
.commentmetadata {
font-size: 0.8em;
border-bottom-width: 1px;
border-bottom-style: dotted;
border-bottom-color: #00000;
}
COMMENTS.PHP
<?php
// Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
// Standard WordPress comments security
if ( post_password_required() ) {
echo '<p class="nocomments">This post is password protected. Enter the password to view comments.</p>';
return;
}
?>
<?php if (have_comments()): ?>
<h4 id="comments">
<?php comments_number('No Comments', 'One Comment', '% Comments' );?>
</h4>
<div class="navigation">
<div class="alignleft">
<?php previous_comments_link() ?>
</div>
<div class="alignright">
<?php next_comments_link() ?>
</div>
<br/>
</div>
<ol class="commentlist">
<?php wp_list_comments(); ?>
</ol>
<div class="navigation">
<?php paginate_comments_links(); ?>
</div>
<?php else: // this is displayed if there are no comments so far ?>
<?php if (comments_open()): // If comments are open, but there are no comments. ?>
<?php else: // comments are closed ?>
<p class="nocomments">Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if (comments_open()): // The comment form ?>
<div id="respond">
<h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>
<div class="cancel-comment-reply">
<small><?php cancel_comment_reply_link(); ?></small>
</div>
<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
<p>You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in</a> to post a comment.</p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( is_user_logged_in() ) : ?>
<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out »</a></p>
<?php else : ?>
<p>
<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label><br>
<input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
</p>
<p>
<label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label><br>
<input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
</p>
<p>
<label for="url"><small>Website</small></label><br>
<input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
</p>
<?php endif; ?>
<!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
<p><textarea name="comment" id="comment" rows="10" tabindex="4"></textarea></p>
<p><?php show_subscription_checkbox(); ?></p>
<p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
<?php comment_id_fields(); ?>
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head ?>
It seems my code attachment failed somehow. Let's try again...
.commentlist .bypostauthor {
color: #FFFFFF;
background-color: #000000;
}
.commentlist .byuser {
color: #330066;
background-color: #E2ECF5;
}
ASKER
Hi Kravimir,
Thanks! I tried that, but it still didn't make any difference.
I also tried
.commentlist li.bypostauthor
.commentlist li.byuser
Still nothing.
Thanks! I tried that, but it still didn't make any difference.
I also tried
.commentlist li.bypostauthor
.commentlist li.byuser
Still nothing.
Would you please open the page in your browser and then do a File ==> Save as (or "save page as") and choose complete, not "HTML only", and then post the resulting html and css file(s) here for us to look at?
ASKER
Sure. I'm attaching them now. There were several stylesheets in the saved as folder, but I only made one. There are other js files, but I'll hold off on those unless you want them.
Thank you again!
Through-A-Lens-Darkly---Dark-Val.htm
style.css
style000.css
style001.css
style-002.css
Thank you again!
Through-A-Lens-Darkly---Dark-Val.htm
style.css
style000.css
style001.css
style-002.css
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To learn more about specificity, check these out:
http://www.sitepoint.com/article/get-specific-css-styles
http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html
http://juicystudio.com/displayarticle.php?page=selector-specificity.php