Andy Ashwin
Andy Ashwin

Reputation: 121

Styling PHP with CSS

Sorry if this is a bit dumb but I have never dabbled with PHP before.

Basically I am using a premium wordpress theme called Kingsize, which is beautiful but does not have the author displayed on a post. I have managed to get it in there, on the individual post (by editing single.php) and the post list (loop.php).

I guess I did that sort of right because it is appearing in there. Problem is in both instances it is on the line beneath the date and I want it on same line:

http://bathastronomers.co.uk/category/bath-astronomers/

I thought I could figure it out if I found "post_date" in the style.css but it doesn't appear to be there!

Also, I want rid of the little icons before date and author.

Any ideas?

Here's the relevant code in single.php:

<?php 
if( $data['wm_date_enabled'] == '1' ) { //data is enabled
?>
<div class="metadata">
        <p class="post_date"><?php the_time(get_option('date_format'));?></p> 
                                 <p class="post_author"><?php the_author(); ?></p>
         </div> 
        <?php}
?>

Upvotes: 0

Views: 111

Answers (2)

Alexandre Lavoie
Alexandre Lavoie

Reputation: 61

If you want the author to appear on the same line as the Date, add this to your style.css :

.post .metadata p.post_date {
float:left;
}

If you want to hide the small icon on the left, modify the following :

.post .metadata p {
padding: 0px 0px 0px 25px;
background: url("images/calendar.png") no-repeat scroll left -1px transparent;
}

For the following :

.post .metadata p {
padding: 0px;    
}

Note that you don't "style PHP". You style HTML. To put it simply, PHP is a HTML generator.

Upvotes: 1

WebNovice
WebNovice

Reputation: 2220

Change it to:

<div class="metadata">
    <p>
    <span class="post_date"><?php the_time(get_option('date_format'));?></span> 
    <span class="post_author"><?php the_author(); ?></span>
    </p>
</div>

Upvotes: 3

Related Questions