php - Editing function in WordPress template - can edit just one variable? -
i know pretty no php other i've tinkered on wordpress, i'm trying customize theme allow 2 authors listed on front-end of posts.
i installed co-authors plus plugin (here) , end it's working well, both authors show up.
for show on front end, according several support articles need adjust theme functions check if there multiple authors, , if display them.
i understand basics , identified theme file, have no idea how incorporate because seems theme isn't calling function display authors, it's calling variable in larger function (again, don't know php, if i'm wrong here, please let me know).
this bare bones code provided co-authors plus:
if ( function_exists( 'coauthors_posts_links' ) ) { coauthors_posts_links(); } else { the_author_posts_link(); } but when in functions file don't see go. see this:
// mom_post_meta function mom_posts_meta ($class = '', $display = null) { $num_comments = get_comments_number(); // get_comments_number returns numeric value if ( comments_open() ) { if ( $num_comments == 0 ) { $comments = __('no comments', 'theme'); } elseif ( $num_comments > 1 ) { $comments = $num_comments .' '. __(' comments', 'theme'); } else { $comments = __('1 comment', 'theme'); } $write_comments = '<a href="' . get_comments_link() .'">'. $comments.'</a>'; } else { //$write_comments = __('comments off', 'theme'); $write_comments = ''; } $author_link = esc_url( get_author_posts_url( get_the_author_meta( 'id' ) ) ); if (class_exists('userpro_api')) { global $userpro; $author_link = $userpro->permalink(get_the_author_meta( 'id' )); } $categories = get_the_category(); $separator = ', '; $cats = ''; if($categories){ foreach($categories $category) { $cats.= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "view posts in %s", 'theme' ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator; } } $output = '<div class="mom-post-meta '.$class.'">'; $author = mom_option('post_meta-author') == 1 ? '<span class="author vcard">'.__('posted by:', 'theme').' <span class="fn"><a href="'.$author_link.'">'.get_the_author().'</a></span></span>': ''; $date = mom_option('post_meta-date') == 1 ? '<span>'.__('on:', 'theme').' <time datetime="'.get_the_time('c').'" itemprop="datepublished" class="updated">'.get_mom_date_format().'</time></span>': ''; //$date = mom_option('post_meta-date') == 1 ? '<span>'.__('the last update:', 'theme').' <time datetime="'.get_the_time('c').'" itemprop="datepublished" class="updated">'. get_post_modified_time(mom_option('date_format')).'</time></span>': ''; $cat = mom_option('post_meta-cat') == 1 ? '<span>'.__('in', 'theme').': '.trim($cats, $separator).'</span>': ''; $comments = mom_option('post_meta-comments') == 1 ? '<span>'.$write_comments.'</span>': ''; if ($display == 'date_comments') { $output .= $date.$comments; } else { $output .= $author.$date.$cat.$comments; } if(function_exists('the_views')) { $output .= '<span>'.__('views:', 'theme').' '.the_views(false).'</span>'; } $output .= get_mom_show_review_score(); $output .= '</div>'; echo $output; } i see $author line defines output on front end, without understanding of php i'm not sure how include if-else statement in there. tried few amateur edits, , got errors. guidance of how incorporate while preserving theme styling appreciated.
i'm using momizat's goodnews theme.
Comments
Post a Comment