add class to element if user is not logged in

Please help . I need to add class to this button if user is not logged in

?php echo apply_filters( 'my_order_html', 'button type=submit class=ADD-CLASS-HERE cfw-primary-btn cfw-next-tab validate name=my_list_html id=place_order formnovalidate=formnovalidate value=' . esc_attr( $order_button_text ) . ' data-value=' . esc_attr( $order_button_text ) . 'span class=cfw-button-text' . esc_html( $order_button_text ) . '/span/button' ); // @codingStandardsIgnoreLine ?

Topic session logout users login Wordpress

Category Web


You can try something like this and implement it in your own case

<?php
if ( is_user_logged_in() ) {
   $extraClass = "hide-button";
} else {
   $extraClass = "";
}
?>

<a class="<?php echo $extraClass;? href="#">">Button text</a>

and give the new class a styling like "display: none;" or something

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.