Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3487

    This is the code:

    <div class=”postauthor”>

    <?php echo get_avatar( get_the_author_id() , 80 ); ?>

    <h4>Autor des Artikels: <?php the_author(); ?></h4>

    <p><?php the_author_description(); ?></p>

    </div><!–end postauthor–>

    Normally added in single.php below <?php the_content(__(”)); ?> but in this framework, no the_content exists :D

    Any idea where to add?

    Thanks, Jakob

    #42495

    Hey,

    BroadScope uses a new WP feature called get_template_part so code can be included in pages more efficiently (you can reuse the same code in multiple locations without needing to update multiple files). To put an analogy on this, it’s like using CSS instead of inline styles.

    The code in single.php is:

    get_template_part( 'includes/loop', 'index' );

    which indicates the path to the file is includes/loop.php. The index parameter adds -index to the file path so if it exists the file includes/loop-index.php would be called; falling back to includes/loop.php if it didn’t. This makes it easier to update code for child themes where they use one parent theme file for most of the loop (or other functions).

    So, to edit the file to add the post author box there are a few steps to take:

    1.) In single.php, change:

    get_template_part( 'includes/loop', 'index' );

    to:

    get_template_part( 'includes/loop', 'single' );

    This will now look for includes/loop-single.php.

    2.) In the includes folder, duplicate loop-index.php and rename it to loop-single.php.

    3.) Open up loop-single.php and add your code immediately under the_content like this:

    <div class="entry-content four_fifth">
    <?php
    $size = 'blog';
    echo avia_inc_display_featured_within_entry();

    the_content(__('Read more','avia_framework'));
    ?>

    <div class="postauthor">
    <?php echo get_avatar( get_the_author_id() , 80 ); ?>
    <h4>Autor des Artikels: <?php the_author(); ?></h4>
    <p><?php the_author_description(); ?></p>
    </div><!--end postauthor-->

    </div>

    4.) Save and upload.

    5.) Let me know how you get on :)

    James

    #42496

    Awesome, working very well. Thank you! :)

    #42497

    Glad that James could help you :)

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Add "about the author" box to single.php’ is closed to new replies.