Skip to content

Instantly share code, notes, and snippets.

@cameronjonesweb
Last active March 6, 2022 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cameronjonesweb/862fdd2a388ad62ef414bf761dfc8622 to your computer and use it in GitHub Desktop.
Save cameronjonesweb/862fdd2a388ad62ef414bf761dfc8622 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'user_contactmethods', 'add_kofi_user_contactmehod' );
function add_kofi_user_contactmehod( $methods ) {
$methods['kofi'] = 'Ko-fi Username';
return $methods;
}
function create_kofi_button_from_user_meta() {
$kofi = get_the_author_meta( 'kofi', get_the_author_ID() );
if ( ! empty( $kofi ) ) {
echo do_shortcode( '[kofi]' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment