• The author’s name appears automatically on a post, but not on a page.

    To put in on a page, it is necessary to add the following php command, somewhere:

    <?php the_author() ?>

    In which php file should it be added in 2015 theme, and where should it be placed on that page?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I would add it on next line after:

    get_template_part( 'content', 'page' );

    of page.php

    I also would first create a Child Theme. Edits to parent themes are lost on theme updates.

    Thread Starter GrahamDLovell

    (@grahamdlovell)

    Thanks for that. It works there provided I remove the ?php “embrace” and add a semi-colon.

    However, is there a place I can put it so that the author name appears before the sharing buttons?

    It must be somewhere inside the get_template_part function, but I cannot work out where that call goes.

    What are you using to output the sharing buttons, the theme or a plugin and where are they output. Please provide a site link and be quite specific.

    If you want it to appear between the Page Title and the Page Content, then you need to modify the file called content-page.php in your 2015 Theme.

    Back that file up first!

    Then put it around line 18, between

    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    	</header><!-- .entry-header -->

    So that it looks like this:

    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    <?php the_author(); ?>
    </header><!-- .entry-header -->

    Noting my last post, please do not directly edit parent theme files. Using a

    Child Theme

    will insure that any edits are not lost on parent theme update. If you have already edited any parent theme files, just include those edited files in your Child Theme (and activate the child theme once all set up) and then overwrite the edits in the parent theme with the original files…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Author's name on a page’ is closed to new replies.