Jump to content

[SOLVED] Formatting Hyperlinks


Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/68817-solved-formatting-hyperlinks/
Share on other sites

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.

 

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?

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.