WordPress.org

Ready to get started?Download WordPress

Forums

Can't get "author" to stay on same line as date in theme template (3 posts)

  1. Cruzn15
    Member
    Posted 7 years ago #

    I'm setting up a blog using the "nobus" theme. I have pretty much everything configured the way I want to, except for where the author appears on each line. I would like the setup to look like "F jS, Y by submitter," but the theme forces them onto separate lines.

    Here's what the code looks like on the page initially.

    <div class="post_entry" id="post-<?php the_ID(); ?>">
    <h1><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
    <div class="author"><?php the_author_posts_link(); ?></div>
    <div class="posted"><?php the_time('F jS, Y') ?> <?php edit_post_link('Edit', '| ', ''); ?></div>
    <div class="posted">tag: <?php the_category(', ') ?></div>

    I tried moving the <div class="author...link(); ?></div> behind the time code, but it throws the author info onto the line following the date.

    I played around with the theme's CSS. Here's the codes that pertain to each property:

    .author {
    	float: left;
    	width: 0px;
    	padding-left: 26px;
    	height: 24px;
    	background-image: url(images/player.gif);
    	background-repeat: no-repeat;
    	background-position: left center;
    	font-size: 11px;
    	line-height: 24px;
    	color: #000000;
    }
    .author a:link, .author a:visited {
    	color: #87BBE0;
    	text-decoration: none;
    }
    .author a:hover, .author a:active {
    	color: #87BBE0;
    	text-decoration: underline;
    }
    .posted {
    	font-size: 11px;
    	color: #333333;
    	margin: 0px;
    	float: left;
    	width: 490px;
    	font-weight: normal;
    	padding-top: 2px;
    	padding-right: 0px;
    	padding-bottom: 2px;
    	padding-left: 3px;
    }
    .posted a:link, .posted a:visited {
    	color: #666666;
    	text-decoration: none;
    	font-weight: normal;
    }
    .posted a:hover, .posted a:active {
    	color: #000;
    	text-decoration: underline;
    	font-weight: normal;
    }

    I removed all the code from "author" pertaining to the image. (I don't want the image there.) But after many failed attempts at trying to get them on the same line, I gave up and reverted back to the original code (posted above, with a few color alterations).

    If anyone could give me any tips, it would be greatly appreciated.

  2. moshu
    Member
    Posted 7 years ago #

    By default, new div starts on new line. Remove the div from around the_author and place it in the "date" div.
    <div class="posted"><?php the_time('F jS, Y') ?> by <?php the_author(); ?> <?php edit_post_link('Edit', '| ', ''); ?></div>

  3. Cruzn15
    Member
    Posted 7 years ago #

    You rock! I only know basic HTML, so I've been kind of just piecing things together from my little knowledge of the subject. Good to know the meaning of "div" for future references. Thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags