Skip to content

Instantly share code, notes, and snippets.

@farookibrahim
Created June 23, 2020 09:55
Show Gist options
  • Select an option

  • Save farookibrahim/0f804d663f047cc9124ca97ed3fca841 to your computer and use it in GitHub Desktop.

Select an option

Save farookibrahim/0f804d663f047cc9124ca97ed3fca841 to your computer and use it in GitHub Desktop.
Cartzilla - Single Product "Created by" text change
if( ! function_exists( 'cartzilla_dokan_product_author_info' ) ) {
function cartzilla_dokan_product_author_info( $user_id = null ) {
if( cartzilla_is_dokan_activated()):
if ( ! $user_id ) {
$user_id = get_post_field( 'post_author', get_the_id() );
}
$user_data = get_userdata( $user_id );
$store_info = dokan_get_store_info( $user_id );
$storename = isset( $store_info['store_name'] ) && ! empty( $store_info['store_name'] ) ? $store_info['store_name'] : ( is_object( $user_data ) ? $user_data->display_name : '' );
$gravatar_url = get_avatar_url( $user_id );
if( ! empty( $storename ) ) :
?>
<div class="bg-secondary rounded p-3 mb-2">
<a class="media align-items-center" href="<?php echo esc_url( dokan_get_store_url( $user_id ) ); ?>">
<img class="rounded-circle" width="50" src="<?php echo esc_url( $gravatar_url ); ?>" alt="<?php echo esc_attr( $storename ); ?>">
<div class="media-body pl-2">
<span class="font-size-ms text-muted"><?php echo esc_html__('Created by', 'cartzilla');?></span>
<h6 class="font-size-sm mb-0"><?php echo esc_attr( $storename ); ?></h6>
</div>
</a>
</div>
<?php
endif;
endif;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment