• Resolved frusi

    (@frusi)


    hi all,

    I am having difficulties with a simple tasks. I’d like to display the author name for blog posts. I tried to paste this snippet of code <?php the_author() ?> in various places but with no results. Anyone can help me?

    thanks a lot!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi @frusi,

    This function must be used within The Loop.

    Where are you using it?

    Kind Regards,

    Thread Starter frusi

    (@frusi)

    Thank you so much. I copied the line in the post.php file. I dont have any php knowledge . Shall I put that line on the index.php?

    thanks for helping.

    esmi

    (@esmi)

    Are you using a child theme?

    Thread Starter frusi

    (@frusi)

    no. I looked at the author.php file and it seems that the author should be displayed. I am lost ??

    esmi

    (@esmi)

    Do not edit the theme itself. First create a child theme for your changes.

    Brandon

    (@glassanemone)

    Once you create a child theme, add the below line to your style sheet within the child theme:

    .single-author .entry-meta .author {
    	display: inline;
    }
    Thread Starter frusi

    (@frusi)

    i figured it out a way to display it but I have no idea how to have it align with the rest of the content. anyone?

    https://www.wbruford.com/blog/

    thanks a lot to you all for the suggestion!

    Hi @frusi,

    Awesome, great to see you got that resolved.

    To align it with the rest of the content, just move the code you have added in between any of the following markups.

    <header class="entry-header">
    ....
    </header>
    
    <div class="entry-content">
    ...
    </div>
    
    <footer class="entry-meta">
    ...
    </footer>

    Alternatively you can wrap it in the markup as following and aaply following stylesheet on it.

    <div class="author-link">
    ...// Your code goes here
    </div>
    .author-link{
    margin: 0 auto;
    max-width: 1040px;
    padding: 0 376px 0 60px;
    width: 100%;
    }

    Cheers,

    Thread Starter frusi

    (@frusi)

    @wpmu DEV than you so much for this! I got it solved! ??

    You are most welcome, if I can be of any further assistance please don’t hesitate to ask ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘author name on posts’ is closed to new replies.