hotdog Posted September 11, 2007 Share Posted September 11, 2007 Hi, I am trying to customise a WordPress template (Blocked-10 by The Undersigned - http://themes.wordpress.net/download.php?theme=393.) By default the template has a green background for any blog entries made. I changed the background to white. The problem I now have is that the post information, ie. author, date/time, etc is no longer visible because this text is also in white by default. I am now trying to change the post info to the colour of my choice which is proving quite a challenge for a php novice. By "post info" I mean the line of code Filed by <?php the_author(); ?> at <?php the_time('F jS, Y') ?> under <?php the_category(', ') ?> | <a href="<?php the_permalink(); ?>"><?php comments_number('No comments', '1 comment'... The code to show the post info is located in the file "category.php" and is as follows: <div class="post"> <h2> <?php the_date(); ?> </h2> <h3> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </h3> <div class="thecontent"> <?php the_content(''); ?> </div> <div class="postinfo"> Filed by <?php the_author(); ?> at <?php the_time('F jS, Y') ?> under <?php the_category(', ') ?> | <a href="<?php the_permalink(); ?>"><?php comments_number('No comments', '1 comment', '% comments'); ?></a> </div> </div> In the stylesheet "style.css" the class "post" and "postinfo" are as follows: .post { margin:40px 30px 0 40px; } .post .postinfo { position:relative; font-style:italic; font-size:10px; } I have found that <?php the_category(', ') ?> and <?php comments_number('No comments', '1 comment', '% comments'); ?> in the category.php file are affected by the following code in the stylesheet: a:link, a:visited { color:#FFFFFF; } But there are many more hyperlinks in my blog such as the menu items, so I don't want to change every hyperlinks colour only that of the post info. So how do I force the colour for the post info in the category.php file? Should I do it through the stylesheet and if so what would the code be in category.php, or should I place code directly into the category.php file and if so what would this code be? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/68817-solved-formatting-hyperlinks/ Share on other sites More sharing options...
hotdog Posted September 11, 2007 Author Share Posted September 11, 2007 I have tried the following in my stylesheet: a.nav:link {color: #31383b; text-decoration: none; } a.nav:visited {color: #31383b; text-decoration: none; } a.nav:hover {color: #31383b; text-decoration: underline; } a.nav:active {color: #31383b; } and the following in the category.php file: Filed by <?php the_author(); ?> at <?php the_time('F jS, Y') ?> under <?php the_category(', ') ?> | <a class="nav" href="<?php the_permalink(); ?>"><?php comments_number('No comments', '1 comment', '% comments'); ?></a> but this has had no effect on the colour of the link. Quote Link to comment https://forums.phpfreaks.com/topic/68817-solved-formatting-hyperlinks/#findComment-345892 Share on other sites More sharing options...
moberemk Posted September 11, 2007 Share Posted September 11, 2007 Easier still, just use .postinfo a:link{} and so on; by defining that it should only apply to a tags inside the .postinfo class, it limits the color to that particular block. Quote Link to comment https://forums.phpfreaks.com/topic/68817-solved-formatting-hyperlinks/#findComment-345901 Share on other sites More sharing options...
hotdog Posted September 11, 2007 Author Share Posted September 11, 2007 Thanks, I've done as you suggested and placed the following into my stylesheet: .postinfo a:link{ color:#31383B; } The post info is now coloured correctly for the <?php the_category(', ') ?> parameter but has not changed for the second part which is the <a href="<?php the_permalink(); ?>"><?php comments_number('No comments', '1 comment', '% comments'); ?> and this is the part inside the hyperlink so I'm not sure how that works?! Can I use the div tag to apply the .postinfo a:link to this entire post info section? Quote Link to comment https://forums.phpfreaks.com/topic/68817-solved-formatting-hyperlinks/#findComment-345925 Share on other sites More sharing options...
moberemk Posted September 11, 2007 Share Posted September 11, 2007 Can you post the generated HTML and not just the PHP? That would help a lot, given my lack of wordpress experience. Quote Link to comment https://forums.phpfreaks.com/topic/68817-solved-formatting-hyperlinks/#findComment-346427 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.