WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Post Author not showing up... (23 posts)

  1. sbarker
    Member
    Posted 4 years ago #

    http://www.bmxfu.com

    When I'm posting a new topic, the author does not show up.
    We have two posts so far on our i site by two different users. It would be great to be able to have the names, tags, etc show up under the post title.

    I'm pretty new to this so any help at all would be greatly appreciated.

    Thanks.

  2. MichaelH
    Member
    Posted 4 years ago #

    The WordPress Default theme has an example of the_author in the wp-content/themes/default/index.php but the code is 'commented-out' so it doesn't execute. So if you wanted to display the author info with the WordPress Default theme you would change the line in wp-content/theme/default/index.php
    from:
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    to
    <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?> </small>

    Note the use of the template tag, the_author_posts_link(), which causes the author's name to be presented as a link to his/her posts.

    This also demonstrates the template tag, the_time(), which displays the date.

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    Easiest way is to find a new theme, one that already includes that function....if you are feeling brave and wanna dive into your theme then.....

    you need to include the appropriate template tags in your theme.
    http://codex.wordpress.org/Template_Tags

    probably in index.php, you'll need to add something like:
    Find a line that looks similar to this....this displays your title
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    Adding:
    Posted by <?php the_author(); ?> with these tags: <?php the_tags(); ?>

    would display the author, and tags

    by looking at the first link I posted discussing template tags, you can see how to get all sorts of info to display

  4. sbarker
    Member
    Posted 4 years ago #

    This is what I found

    <div class="PostTime"><span class="PostDay"><?php the_time('j') ?></span> <span class="PostEra"><?php the_time('M Y') ?></span></div>
    	<h2><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    	<small class="PostDet"><?php edit_post_link('Edit', '', ' | '); ?> Author: <?php the_author(); ?> | Filed under: <?php the_category(', ') ?>
    	</small>
    
    	</div>

    Do I need to move the <h2> and <small> around?

  5. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    what are you trying to do? I'm not sure why you are asking that?

    If you don't like how that is styled you may have to move the h2 and small, I'm not sure what your are trying to accomplish?

    also, is that the exact code from your theme you pasted? It already has the author in it.....is the author not showing up?

  6. sbarker
    Member
    Posted 4 years ago #

    Copied and pasted from index.php
    Yeah, the author is not showing up at all.
    Only the date and the post title.

  7. sbarker
    Member
    Posted 4 years ago #

    Just to clear things up....

    http://www.bmxfu.com
    That's my site there.

    As you can see, the date and name of the post show up. It looks like there is room under the title for things such as the authors name, tages, categories etc.

    This is the code that I copied and pasted from the index.php page...

    <div class="PostTime"><span class="PostDay"><?php the_time('j') ?></span> <span class="PostEra"><?php the_time('M Y') ?></span></div>
    	<h2><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    	<small class="PostDet"><?php edit_post_link('Edit', '', ' | '); ?> Author: <?php the_author(); ?> | Filed under: <?php the_category(', ') ?>
    	</small>
    
    	</div>

    It seams like everything should be there but nothing is showing up. This is all new to me so all the help is very much appreciated.
    Thank you.

  8. sbarker
    Member
    Posted 4 years ago #

    Does anybody know what might be the issue? I still can't figure it out.
    Thanks.

  9. sbarker
    Member
    Posted 4 years ago #

    I've looked on some different forums and sites and still can't figure it out....

  10. Kevin Kwok
    Member
    Posted 4 years ago #

    is the author of all these posts the admin? if so that "may" be why its not showing.

    also where are you pasting that code? can you show us your whole index.php?

  11. sbarker
    Member
    Posted 4 years ago #

    There are other people posting as well.

    index.php......

    <?php get_header(); ?>
    
    	<div id="content" class="narrowcolumn">
    
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">
    
    								<div class="PostHead">
    
    	<div class="PostTime"><span class="PostDay"><?php the_time('j') ?></span> <span class="PostEra"><?php the_time('M Y') ?></span></div>
    	<h2><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    	<small class="PostDet"><?php edit_post_link('Edit', '', ' | '); ?> Author: <?php the_author(); ?> | Filed under: <?php the_category(', ') ?>
    	</small>
    
    	</div>
    
    			<div class="entry">
    <!-- Ads -->
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    			</div>
    			</div>	
    
    			<p class="postmetadata">
    			<span class="tags"><?php the_tags('Tags: ', ', '); ?> </span>
    			</p>
    
    			<div class="comments"><?php comments_popup_link('NO COMMENTS', '<span> 1 </span> COMMENTS', '<span> % </span> COMMENTS'); ?></div>
    <br />
    		<?php endwhile; ?>
    <div class="navigation"><div class="alignleft"><?php previous_posts_link(); ?></div><div class="alignright"><?php next_posts_link(); ?></div></div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    	<?php endif; ?>
    
    	</div>
    
    <?php get_sidebar(); ?>
    <?php include( TEMPLATEPATH . '/right.php' ); ?>
    
    </div>
    
    <?php get_footer(); ?>
  12. Kevin Kwok
    Member
    Posted 4 years ago #

    instead of <?php the_author(); ?>

    try....

    <?php the_author_meta(); ?>

    or

    <?php the_author_posts_link(); ?>

  13. sbarker
    Member
    Posted 4 years ago #

    I tried both and it seems like neither made a difference.
    Thank you for the suggestions though....

  14. Kevin Kwok
    Member
    Posted 4 years ago #

    hmm well ive tired your code on my own site, and it shows up just fine. so it must be something else on your site conflicting with the code on your site.

  15. MichaelH
    Member
    Posted 4 years ago #

    Probably something in your CSS but I'm not a CSS person.

  16. Kevin Kwok
    Member
    Posted 4 years ago #

    just for my curiosity can you use this as your index.php and tell me if it works

    <?php get_header(); ?>
    
    <div id="content" class="narrowcolumn">
    <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>"><div class="PostHead">
    
    <?php the_time('j') ?><BR />
    <?php the_time('M Y') ?><BR />
    <a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><BR />
    <?php edit_post_link('Edit'); ?> <BR />
    Author: <?php the_author(); ?> <BR />
    Filed under: <?php the_category(', ') ?><br />
    
    <div class="entry"><?php the_content('Read the rest of this entry &raquo;'); ?></div></div>
    <p class="postmetadata"><span class="tags"><?php the_tags('Tags: ', ', '); ?></span></p>
    
    <div class="comments"><?php comments_popup_link('NO COMMENTS', '<span> 1 </span> COMMENTS', '<span> % </span> COMMENTS'); ?></div>
    <br /><?php endwhile; ?><div class="navigation"><div class="alignleft">
    <?php previous_posts_link(); ?></div><div class="alignright"><?php next_posts_link(); ?></div></div>
    
    <?php else : ?><h2 class="center">Not Found</h2><p class="center">Sorry, but you are looking for something that isn't here.</p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div>
    
    <?php get_sidebar(); ?><?php include( TEMPLATEPATH . '/right.php' ); ?></div>
    <?php get_footer(); ?>
  17. sbarker
    Member
    Posted 4 years ago #

    So, I just copeied and pasted that code in.
    The authors showed up as well as the categories that they were posted in but everything was all over the place, things were overlapping, footer was at the top, all of the widjets were missing, etc...

  18. Kevin Kwok
    Member
    Posted 4 years ago #

    yea i took out all your div and span tags because i just wanted to see that everything was at least functioning. so michael was right it is something to do with your css ; your span and div tags surrounding the links in your original code.

    i would go in and double check everything

  19. sbarker
    Member
    Posted 4 years ago #

    So its something in sytle.css?

    /* Layout
    --------------------------------------------------------------- */
    
    .primarynav{
    height: 40px;
    width:1004px;
    margin: 0 auto;
    position: relative;
    top: 50px;
    z-index: 9999;
    height: 30px;
    }
    
    .primarynav *{
    list-style: none;
    }
    
    .primarynav li.current_page_item a, .primarynav li a.current_page_item {
    color: #FFF;
    }
    
    .primarynav li.pagenav{
    overflow:hidden;
    width:545px;
    }
    
    .primarynav ul{
    top:22px;
    left: 0;
    list-style: none;
    }
    
    .primarynav ul.bg{
    background:transparent url(images/bg.jpg) repeat scroll 0 0;
    overflow: hidden;
    width: 507px;
    height: 25px;
    position:absolute;
    padding-left: 15px;
    padding-top:5px;
    right:0;
    top:0;
    }
    
    .primarynav ul li{
    float: left;
    list-style: none;
    }
    
    .primarynav a{
    font-size: 24px;
    font-family: Helvetica, Arial, Verdana;
    text-transform:lowercase;
    color: #3f514a;
    padding-right: 25px;
    letter-spacing: -1px;
    text-decoration: none;
    color: #000;
    }
    
    .primarynav a:hover{
    color: #fff;
    }
    
    .primarynav a.topnav_rss{
    background:transparent url(images/rss.jpg) repeat scroll 0 0;
    padding:0 10px 0 30px;
    padding-top:5px;
    position:absolute;
    right:0;
    top:0;
    overflow: hidden;
    width: 180px;
    height: 25px;
    text-align: center;
    font-family: Helvetica, Arial, Verdana;
    font-size: 24px;
    color: #000;
    text-transform: lowercase;
    }
    
    .primarynav a.topnav_rss:hover{
    color: #fff;
    }
    
    .primarynav h2{
    display: none;
    }
    
    .navigation {
    margin: 5px 0px 20px;
    height: 20px;
    width: 480px;
    }
    
    .navigation .alignleft {
    float: left;
    width: 50%;
    }
    
    .navigation .alignright {
    	float: right;
    	text-align: right;
    	width: 50%;
    }
    
    #sidebar{
    width:285px;
    float: left;
    background: transparent url(images/sidebarbg.gif) repeat-y center top;
    }
    
    #sidebar a:hover{
    color: #FFF;
    }
    
    #sidebar h1.logo{
    width: 250px;
    padding: 0px;
    margin: 0px auto;
    }
    
    #sidebar h1.logo a{
    background: url(images/logo.gif) no-repeat center top;
    width: 250px;
    height: 120px;
    display: block;
    overflow: hidden;
    text-indent: -999px;
    border-top:6px solid #111f22;
    }
    
    input#submit{
    border:1px solid #7BA2AD;
    padding: 10px;
    font-family: Helvetica, Arial, Verdana;
    background: #242f31;
    text-transform: uppercase;
    color: #FFF;
    cursor: pointer;
    font-size: 14px;
    }
    
    #commentform input#submit{
    float: right;
    }
    
    #sidebar h2{
    padding: 10px 10px 20px 10px;
    background: url(images/heads.jpg) no-repeat center;
    font-family: Helvetica, Arial, Verdana;
    font-size: 18px;
    color: #FFF;
    font-weight: bold;
    letter-spacing: -1px;
    text-transform: uppercase;
    }
    
    .narrowcolumn textarea{
    border:2px solid #7BA2AD;
    width:93%;width:415px;
    font-family: Arial, Helvetica, Verdana;
    font-size: 16px;
    padding: 5px;
    }
    
    .narrowcolumn h2.pagetitle{
    margin-top: 30px;
    text-transform: uppercase;
    }
    
    .narrowcolumn #commentform label{
    display: block;
    float: left;
    text-align: right !important;
    width:130px;
    }
    
    .narrowcolumn #commentform{
    margin: 0px auto;
    overflow: hidden;
    height: 1%;
    }
    
    .narrowcolumn #commentform label small{
    float: right;
    }
    
    .narrowcolumn .add_comment h3#respond{
    font-family: Helvetica, Arial, Verdana;
    font-size: 20px;
    text-transform: uppercase;
    padding:10px;
    margin: 10px 0px;color: #293538;
    border-bottom: 2px solid #293538;
    text-align: right;
    position: absolute;
    top:-10px;
    left: 0px;
    letter-spacing: -1px;
    width: 430px;
    }
    
    .narrowcolumn .add_comment{
    position: relative;
    padding:55px 10px 40px 10px;
    margin: 10px 0px;
    }
    
    .narrowcolumn #commentform #author, .narrowcolumn #commentform #email, .narrowcolumn #commentform #url{
    float: right;
    border:2px solid #7BA2AD;
    font-family: Arial, Helvetica, Verdana;
    font-size: 16px;
    padding:5px 5px;
    width:245px;
    }
    .narrowcolumn #commentform #author:focus, .narrowcolumn #commentform #email:focus, .narrowcolumn #commentform #url:focus, .narrowcolumn textarea:focus{
    background:#FFFFF5;
    }
    
    .narrowcolumn #commentform p{
    clear: both;
    overflow: hidden;
    padding: 5px 0px;
    height: 1%;
    }
    
    .innerpage .post{
    padding-top: 40px !important;
    }
    
    #sidebar ul li ul li{
    border-bottom:1px solid #1F2A2C;
    }
    
    #sidebar ul li ul.top_commenters{
    margin: 0px auto;
    }
    
    #sidebar ul li ul.top_commenters li{
    padding-top: 10px;
    }
    
    #sidebar ul li ul{
    width:80%;
    margin: 0px auto;
    }
    
    #sidebar ul li ul li{
    display: block;
    padding-bottom: 10px;
    }
    
    #sidebar ul li ul li a{
    color: #888d8f;
    font-family: Helvetica, Arial, Verdana;
    text-transform: uppercase;
    letter-spacing: -1px;
    font-size: 13px;
    text-decoration: none;
    }
    
    #sidebar ul li ul{
    margin: 10px auto 0px auto;
    }
    
    #sidebar .description{
    width:230px;
    font-family: Helvetica, Arial, Verdana;
    margin: 0px auto;
    color: #a8acad;
    }
    
    #sidebar .searchfield{
    width:250px;
    margin: 0px auto;
    overflow:hidden;
    clear: both;
    padding: 5px 0px 3px 0px;
    }
    
    #sidebar .searchfield span, #sidebar .searchfield label{
    display: none;
    } 
    
    #sidebar .searchfield input#searchsubmit{
    border: none;
    width:55px;
    height: 28px;
    display: block;
    overflow: hidden;
    text-indent: -999px;
    line-height: 0;
    float: left;
    background: #0d1618 url(images/search_btn.gif) no-repeat center;
    cursor: pointer;
    }
    
    #sidebar .searchfield input{
    border: none;
    color: #ededed;
    background: #666;
    float:left;
    height:16px;
    padding:6px;
    width:183px;
    }
    
    .sidebar-right{
    width:175px;
    float: left;
    padding-top: 70px;
    margin-left: 12px;
    }
    
    .right-widget{
    width: 175px;
    height: 25px;
    padding:5px 0 5px 14px;
    text-transform: uppercase;background:transparent url(images/bg.jpg) repeat scroll 0 0;
    overflow: hidden;
    font-weight: bold;
    text-align: left;
    font-family: Helvetica, Arial, Verdana;
    font-size: 16px;
    color: #fff;
    border-top: 15px solid #fff;
    border-bottom: 10px solid #fff;
    }
    
    .narrowcolumn, .widecolumn{
    float: left;
    padding-top:40px;
    width:480px;
    }
    
    .narrowcolumn .post{
    padding-right: 30px;
    position: relative;
    padding-bottom: 0px;
    padding-top: 113px;
    }
    
    p.postmetadata{
    padding-bottom: 20px;
    display: none;
    }
    
    .comments a{
    text-decoration: none;
    font-size: 12px;
    text-transform: lowercase;
    background: #D0E6EC url(images/comments.gif) no-repeat scroll 99% 50%;
    display: block;
    margin-left: -15px;
    padding-right: 25px;
    width:460px;
    text-align: right;
    margin-bottom: 20px;
    }
    
    .narrowcolumn .post .comments a span{
    font-size: 12px;
    }
    
    .PostHead{
    left:-30px;
    position:absolute;
    top:30px;
    }
    
    .PostHead h2, .innerpage .post h2{
    float: left;
    width:360px;
    padding-top: 5px;
    padding-left: 11px;
    font-size: 30px;
    font-family: Helvetica, Arial, "Trebuchet MS";
    letter-spacing: -1px;
    text-transform: uppercase;
    text-decoration: none;
    }
    
    .innerpage .post h2{
    float:none;
    padding-left: 0px;
    width:auto;
    }
    
    .PostHead h2 a{
    font-size: 30px;
    font-family: Helvetica, Arial, "Trebuchet MS";
    letter-spacing: -1px;
    text-transform: uppercase;
    text-decoration: none;
    }
    
    .PostTime{
    float:left;
    overflow:hidden;
    width:100px;
    }
    
    .PostHead small.PostDet, .PostHead small.PostDet a{
    font-size: 12px;
    text-decoration: none;
    }
    
    .PostHead small.PostDet{
    clear:both;
    display:block;
    left:10px;
    position:absolute;
    top:-26px;
    height: 23px;
    width:395px;
    overflow: hidden;
    display: none;
    }
    
    .PostDay{
    background:#C30301 none repeat scroll 0 0;
    clear:both;
    color:#FFFFFF;
    display:block;
    font-family:Helvetica,Arial,"Trebuchet MS";
    font-size:62px;
    font-weight:bold;
    height:54px;
    line-height:58px;
    overflow:hidden;
    padding:0;
    text-align:right;
    width:95px;
    z-index:999;
    }
    .PostEra{
    background: #293538;
    color: #FFF;
    padding:0px;
    display: block;
    width:95px;
    left: 0;
    font-size: 14px;
    text-align: right;
    }
    
    #page{
    background: transparent url(images/wrapperbg.jpg) repeat-x center top;
    width:959px;
    margin: 0px auto;
    overflow: hidden;
    padding: 0px 15px 0px 30px;
    position: relative;
    z-index: 999;
    }
    
    .bgimage{
    width:1004px;
    margin: 0px auto;
    background: #FFF url(images/sidebarbg.gif) repeat-y 511px 0px;
    }
    
    div.twitter{
    background:#FFFFFF url(images/twitter.gif) no-repeat scroll left top;
    margin-left:-14px;
    overflow:hidden;
    padding-top:20px;
    width:200px;
    }
    
    div.twitter-content{
    border-top:medium none;
    overflow:hidden;
    padding:0px 15px 0px 35px;
    height: 135px;
    }
    
    div.twitter-content *{
    font-size: 12px;
    line-height: 18px;
    width: 100%;
    }
    
    div.twitter-content li{
    padding-top: 2px;
    }
    
    div.twitter-content li span{
    clear: both;
    display: block;
    width:131px;
    }
    
    a.followme{
    display: block;
    width: 175px;
    padding: 0 0 10px 0;
    text-indent: -999px;
    letter-spacing: -1px;
    color: #AB3730;
    text-decoration: none;
    }
    
    img.pdlogo{
    margin-top: 15px;
    clear: both;
    }
    
    .google-ads{
    width:175px;
    overflow: hidden;
    padding-top: 20px;
    float: left;
    display: block;
    margin-left: 15px;
    }
    
    #sidebar ul.top_commenters li{
    float: left;
    padding-left: 15px;
    }
    
    #sidebar ul.top_commenters li span img{
    border: 3px solid #101C1F;
    overflow: hidden;
    display: block;
    width:32px;
    height:32px;
    }
    
    #sidebar ul.top_commenters li span img:hover{
    border: 3px solid #FFF;
    }
    
    /* Comments */
    
    ol.commentlist li{
    padding: 10px;
    background: #D0E6EC;
    margin-bottom: 15px;
    border: 2px solid #7BA2AD;
    height: 1%;
    border-top: none;
    font-size: 14px;
    clear: both;
    }
    
    ol.commentlist li cite a{
    font-size: 22px;
    font-style: normal;
    text-decoration: none;
    }
    
    .authordiv{
    padding-bottom:25px;
    background: transparent url(images/author.gif) no-repeat left bottom;
    overflow:hidden;
    padding:13px 0px 13px 73px;
    }
    .authordiv img{
    float: left;
    border: 2px solid #7BA2AD;
    }
    li.authorli{
    padding: 0px !important;
    margin: 0px !important;
    background: none !important;
    border: none !important;
    }
    
    .authordiv cite{
    padding-left: 10px;
    float: left;
    font-size: 13px;
    width: 200px;
    }
    
    .authordiv small{
    float: left;
    width:330px;
    }
    
    .authordiv small a{
    font-size: 13px;
    padding-left: 10px;
    text-decoration: none;
    }
    
    .authordiv cite a{
    font-style: normal;
    font-weight: bold;
    text-decoration: none;
    }
    
    .CommWidth h3#comments{
    background: #242f31;
    color: #FFF;
    padding-left: 10px;
    margin: 10px auto;
    }
    
    h3#respond{
    background: transparent !important;
    }
    
    .entry{
    padding: 10px 0px;
    }
    
    .entry p{
    padding-bottom: 10px;
    }
    
    .clear{
    clear: both;
    overflow: hidden;
    height: 1%;
    }
    
    #footer{
    width:100%;
    background: #111f22;
    padding: 10px 0px;
    border-top: 4px solid red;
    }
    
    .footerwrap, .footerwrap *{
    width:1000px;
    font-size: 13px;
    margin: 0px auto;
    color: #77959B;
    }
    
    .footerwrap a{
    color: #FFF;
    }
    
    .widget_tag_cloud div {padding: 0 30px; }
    .widget_tag_cloud div a {color: #888; }

    Is there anything in particular that I should be looking for

  20. Kevin Kwok
    Member
    Posted 4 years ago #

    ok i think i got it.
    looking at the original code you had here:

    <div class="PostTime"><span class="PostDay"><?php the_time('j') ?></span> <span class="PostEra"><?php the_time('M Y') ?></span></div>
    	<h2><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    	<small class="PostDet"><?php edit_post_link('Edit', '', ' | '); ?> Author: <?php the_author(); ?> | Filed under: <?php the_category(', ') ?>
    	</small>
    
    	</div>

    your css class used to show the edit, author, filed under, etc is class="postdet"

    so looking in that CSS you just gave me locate this section of your css

    .PostHead small.PostDet{
    clear:both;
    display:block;
    left:10px;
    position:absolute;
    top:-26px;
    height: 23px;
    width:395px;
    overflow: hidden;
    display: none;
    }

    you see where it says display:none; take that line out. try that i think it should fix your problem sorry took me a while to get back to you was sick. let me know if this works

  21. sbarker
    Member
    Posted 4 years ago #

    Wow! Thank you! It's showing up now!

    Ideally it would be under the post title and beside the date but I think that may be asking for too much at this point haha.

    Thanks again!

  22. sbarker
    Member
    Posted 4 years ago #

    I cruedly messed around with the code and its where it needs to be now.
    Thank you once again!

  23. Kevin Kwok
    Member
    Posted 4 years ago #

    you are most welcome dont forget to mark this as "resolved" so it can help someone in the future. have a good one.

Topic Closed

This topic has been closed to new replies.

About this Topic