Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By JoeyRoth on
hi
i added this code to comment.tpl.php
<p class="comment-name">
<?php print render($content['field_commentnickname']); ?>
</p>
and i added this code to css file
.comment .submitted .comment-name {
font-size: 4.2em;
color: #68696b;
}
but the css doesn't work , plz need help.
Comments
Did you clear cache? If so
Did you clear cache? If so did you also make sure that the CSS file you added these lines to is being included within the page?
There's also the potential issue with the selector itself. ".comment .submitted .comment-name" Is that the correct hierarchy?
These are the things I would doube-check with.
Also most browser debugging tools (via F12) and inspecting these elements will help determine whether your CSS is being applied to them.
hi edward, i think everything
hi edward, i think everything is correct, i would like to show you the files
sites\all\themes\specialone\css/style.css
Do none of the styles work at
Do none of the styles work at all or is just that one you added? If none of them work then I'd wager the style isn't loaded. Otherwise most likely the CSS selector is wrong and the specificity you're using is off. As a test try changing it to this just to see if it works:
I did notice this:
sites\all\themes\specialone\css/style.css
Is that the way you pasted it or is that the actual path Drupal is using in an attempt to load your CSS? The path appears invalid and could be causing issues.
hi edward,
hi edward,
I've done everything you told me, but nothing changed
all other codes working good,i've added those codes and it works good :
just the comment code is not working
the path i posted is the actual path, the full path is C:\xampp\htdocs\MYWEBSITE\sites\all\themes\specialone\css\style.css
i'm sure is the correct path, the problem is between css file and template file
Hmm, so far the only other
Hmm, so far the only other thing I can think of is Browser Cache. Try loading up the site in another browser or clear your existing one. Check if you see any changes from there.
i clear the cache everytime i
i clear the cache everytime i make changes in files. and i changed the browser but same problem.
i know where is the problem exactly but i don't know the solution, the problem is in the field i added, because there is relation between the code i added to template file and the field.
1- i created a new field in comment fields (admin/structure/types/manage/article/comment/fields) the name of the new field is (commentnickname) so the field Machine name is (field_commentnickname)
2- then i added the codes to template file and css file.
and i just added new codes to css file it works
so the problem is because the field but can't know where is the problem exactly