This is the code that is inside a php template. But this will be overwritten when i update the theme because the change is made in the mother theme files.
Is is possible to put this code inside the functions.php child theme file? Or do i have to copy the template files into my child theme? What is the best way to go about keeping these changes for the future? One of the modifications that is made is the code below which just hides an element based upon user-roles in my single listing page.
<?php /** * `Call now` quick action. * * @since 2.0 */ if ( ! ( $phone = $listing->get_field('phone') ) ) return; // if you want to not display anything for guests if ( !is_user_logged_in() ) return; // if you want to not display anything for anyone but administrator or subscriber $user = wp_get_current_user(); if ( !in_array( 'administrator', (array) $user->roles ) && !in_array( 'subscriber', (array) $user->roles ) ) return; $link = sprintf( 'tel:%s', $phone ); ?> <li id="<?php echo esc_attr( $action['id'] ) ?>" class="<?php echo esc_attr( $action['class'] ) ?>"> <a href="<?php echo esc_url( $link ) ?>" rel="nofollow"> <?php echo c27()->get_icon_markup( $action['icon'] ) ?> <span><?php echo $action['label'] ?></span> </a> </li>
Would appreciate any help with this.
Here is a screenshot of the file if its needed, im not sure: