Skip to content

Commit

Permalink
Add site-wide option to hide or display job titles in bios and biogra…
Browse files Browse the repository at this point in the history
…phis, for normal users and for coauthors.
  • Loading branch information
benlk committed Jan 26, 2016
1 parent 7328554 commit 55a7a7b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inc/post-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ function largo_byline( $echo = true, $exclude_date = false, $post = null ) {
$coauthors = get_coauthors( $post_id );
foreach( $coauthors as $author ) {
$byline_text = $author->display_name;
if ( $job = $author->job_title )
$show_job_titles = of_get_option('show_job_titles');
if ( $job = $author->job_title && $show_job_titles )
$byline_text .= ', ' . $job;
if ( $org = $author->organization )
$byline_text .= ' (' . $org . ')';
Expand All @@ -128,7 +129,8 @@ function largo_byline( $echo = true, $exclude_date = false, $post = null ) {
} else {
$authors = largo_author_link( false, $post_id );
$author_id = get_post_meta( $post_id, 'post_author', true );
if ( $job = get_the_author_meta( 'job_title' , $author_id )) {
$show_job_titles = of_get_option('show_job_titles');
if ( $show_job_titles && $job = get_the_author_meta( 'job_title' , $author_id ) ) {
$authors .= ', ' . $job;
}

Expand Down
11 changes: 11 additions & 0 deletions options.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,17 @@ function optionsframework_options() {
'std' => '0',
'type' => 'checkbox');

$options[] = array(
'name' => __('Byline Options', 'largo'),
'type' => 'info');

$options[] = array(
'desc' => __('Enable display of job titles in bylines and author biographies?', 'largo'),
'id' => 'show_job_titles',
'std' => '0',
'type' => 'checkbox');


/*
* Removing inn_member_since in 0.5.2
if ( INN_MEMBER ) { // only relevant in this case, options affecting the logo display
Expand Down
5 changes: 5 additions & 0 deletions partials/author-bio-description.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
echo '<div class="photo">' . $photo . '</div>';
}

// Job!
$show_job_titles = of_get_option('show_job_titles');
if ( $job = $author_obj->job_title && $show_job_titles ) {
echo '<p>' . esc_attr( $author_obj->job_title ) . '</p>';
}
// Description
if ( $author_obj->description ) {
echo '<p>' . esc_attr( $author_obj->description ) . '</p>';
Expand Down

0 comments on commit 55a7a7b

Please sign in to comment.