Codeinwp / neve

A fast, lightweight, AMP ready WordPress theme built with speed and usability in mind.
https://themeisle.com/themes/neve/
GNU General Public License v2.0
262 stars 84 forks source link

Make neve_get_author_meta function pluggable #3778

Closed vytisbulkevicius closed 1 year ago

vytisbulkevicius commented 1 year ago

Description:

Client requested if we can make neve_get_author_meta pluggable so he can configure it to fully support Co-authors plugin - https://wordpress.org/plugins/co-authors-plus/

Full client request:

We have used Co-authors plus multiple times in the past - it always requires some changes in the theme code, see https://docs.wpvip.com/technical-references/plugins/incorporate-co-authors-plus-template-tags-into-your-theme/.

Usually the function, which renders post meta stuff is easy to override in the child theme. In this case it's more complicated.

Here's how I added support for Co-authors in the neve_get_author_meta() function:

public static function neve_get_author_meta( $post_id = null, $show_before = true ) {

global $post;

$current_post = $post_id !== null ? get_post( $post_id ) : $post;

if ( ! isset( $current_post ) ) { return false; }

$markup = '';

$markup .= ''; if ( ! $display_avatar && $show_before ) { $markup .= __( 'by', 'neve' ) . ' '; }

$link = coauthors_posts_links( $between = null, $betweenLast = null, $before = null, $after = null, $echo = false);

$link = apply_filters( 'the_author_posts_link', $link );

$markup .= wp_kses_post( $link ) . '';

return $markup; }

If you could make the neve_get_author_meta()function pluggable, we could override it easily in the child theme. Could you consider that? (See, e.g., https://webdesign.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme--cms-22623)

Alternatives:

Currently his alternative is to override the function in the parent theme which means he should make the change after each update.

Reported here - https://secure.helpscout.net/conversation/2113829429/350664

pirate-bot commented 1 year ago

:tada: This issue has been resolved in version 3.5.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: