Jump to content
Sign in to follow this  
wayside

Creating Bio block for Author pages using

Recommended Posts

wayside

When we had our previous template setup I had added the following code to the author.php page that would display the authors bio. According to WP help guides I need to place this code after the loop which I did, but I can't get this to work. Do I need to add something else?? <?php if (is_author() ) : ?> <?php if ( get_the_author_meta( 'description' ) ) : ?>

<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'platformbase_author_bio_avatar_size', 60 ) ); ?>

<?php printf( __( 'About %s', 'platformbase' ), get_the_author() ); ?>

<?php the_author_meta( 'description' ) ; ?>
<?php endif; ?> <?php endif; ?> Thanks!!

Share this post


Link to post
Share on other sites
wayside

Kastelic - Still very new to PageLines, therefore I haven't though about creating a custom section. However it seems it would be a good time to learn custom sections.

Share this post


Link to post
Share on other sites
catrina

The first step is to make sure that you have the child theme, PlatformBase, enabled so that you make sure you're not editing the parent files in PlatformPro.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
wayside

Catrina - Created a custom section by following the video for creating a section. My question is if I add the section to the Posts Page Content Area Template, will I still be able to pull the author meta data i.e. echo get_avatar( get_the_author_meta( 'user_email' ) from the current author (section should only display for Author pages)???

Share this post


Link to post
Share on other sites
catrina

I think that would be possible, as long as the PHP for the author data is there.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
wayside

I now get the following error.. function PageLinesSection::section_template() must be over-ridden in a sub-class. Code for custom section file: section.authorbior.php class BaseAuthorBio extends PageLinesSection { function __construct( $registered_settings = array() ) { // BASIC INFO /* The name and ID of the section */ $name = __('Authors Bio', 'pagelines'); $id = 'authorbio'; // SETTINGS // Setup description of the section.. $default_settings['description'] = 'Adds Authors profile bio to the top of the Authors page'; // The template areas this section works with.. // Examples areas: 'main', 'content', 'header', 'footer', 'morefoot', sidebar1, array('main', 'content'), etc.... $default_settings['workswith'] = array('main', 'content'); // The icon users will see in the admin.. add the full url here $default_settings['icon'] = CHILD_IMAGES . '/icon-pullquote.png'; // OPS /* Draw section using the section API - don't need to touch this */ $settings = wp_parse_args( $registered_settings, $default_settings ); parent::__construct($name, $id, $settings); } } /* End of section class - No closing tag needed */

Share this post


Link to post
Share on other sites
wayside

UPDATE... got the code to work only issue is the new section only works when placed after the Main Content Section. Any suggestions on how to get the following to post BIO info if placed before the Main Content Section?? <?php /* Section: Author's BIO Section Author: Chris Dembek Description: Add's Authors BIO to the top of the page Version: 1.0.0 Demonstrates how to create a cool site section in 50 lines of code! Note: the only other piece to make this work is the 'pagelines_register_section()' function in your functions.php */ class BaseAuthorBio extends PageLinesSection { function __construct( $registered_settings = array() ) { // BASIC INFO /* The name and ID of the section */ $name = __('Authors Bio', 'pagelines'); $id = 'authorbio'; // SETTINGS // Setup description of the section.. $default_settings['description'] = 'Adds Authors profile bio to the top of the Authors page'; // The template areas this section works with.. // Examples areas: 'main', 'content', 'header', 'footer', 'morefoot', sidebar1, array('main', 'content'), etc.... $default_settings['workswith'] = array('main'); // The icon users will see in the admin.. add the full url here // $default_settings['icon'] = CHILD_IMAGES . '/icon-pullquote.png'; // OPS /* Draw section using the section API - don't need to touch this */ $settings = wp_parse_args( $registered_settings, $default_settings ); parent::__construct($name, $id, $settings); } /* Use this function to create the template for the section */ function section_template() { if (is_author()) { echo '

' ; printf( __( 'About %s', 'platformbase' ), get_the_author() ); echo '

' ; the_author_meta( 'description' ) ; echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'platformbase_author_bio_avatar_size', 60 ) ); } ; <?php } } /* End of section class - No closing tag needed */

Share this post


Link to post
Share on other sites
Kate

Not sure I understand the question, sorry... Are you saying you want to move where the section appears?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×