function assign_pmpro_level_to_role($user_id, $role)
{
global $current_user;
//checks if the user doesn't have a membership level yet
if(!$current_user->user_id) {
//we found a role related to pmpro level
if($role == "customer")
{
pmpro_changeMembershipLevel(6, $user_id); //gives default customers the level 20 free registration membership
}
}
}
add_action('add_user_role', 'assign_pmpro_level_to_role', 10, 2);
$query = new WP_Query( [
'post_type' => 'fitnes_programs',
'posts_per_page' => (int)$count,
'tax_query' => [
[
'taxonomy' => 'fitnes_program',
'field' => 'id',
'terms' => [38]
]
]
] );
$image = get_field('image');
if( !empty( $image ) ) {
echo wp_get_attachment_image( $image, 'thumbnail' );
<?php
$image = get_field('image');
if( !empty($image) ):
$thumb = bfi_thumb( $image['url'], ['width' => 100, 'height' => 100, 'crop' => true] );
printf('<img src="%s" alt="%s" />',$thumb, $image['alt'])
endif; ?>
function cw_change_product_price_display( $price ) {
$user = wp_get_current_user();
if ( in_array( 'subscriber', $user->roles, true ) ) {
$text = 'text for user subscriber';
} elseif ( in_array( 'administrator', $user->roles, true ) ) {
$text = 'text for user administrator';
} elseif ( in_array( 'editor', $user->roles, true ) ) {
$text = 'text for user editor';
} elseif ( in_array( 'author', $user->roles, true ) ) {
$text = 'text for user author';
} elseif ( in_array( 'contributor', $user->roles, true ) ) {
$text = 'text for user contributor';
} else {
$text = 'default text';
}
$price .= sprintf( '<span style="color: #8e8181;font-size: 13px;">%s</span>', $text );
return $price;
}
add_filter( 'woocommerce_get_price_html', 'cw_change_product_price_display' );
add_filter( 'woocommerce_cart_item_price', 'cw_change_product_price_display' );