Hello everyone, I'm in wordpress and I have this template file : <?php $member_ID = $ut_global_member_count; foreach ( $team as $key => $member ) : $clear = ''; ?> <div class="member-box ut-member-style-3 <?php echo $ut_member_box_size; ?> <?php echo $grid[$ut_member_in_row]['class']; ?>"> <?php $avatar_style = 'ut-square'; ?> <?php //$avatar_style = $member['ut_avatar_style']; ?> <div class="mp-holder"> <?php if(!empty( $member['ut_member_pic'] )) : ?> <figure class="member-photo-style-3"> <a href="<?php echo $member['ut_member_pic']; ?>"> <img class="utlazy" src="<?php echo THEME_WEB_ROOT; ?>/images/placeholder/team-member.png" alt="<?php echo $member['ut_member_name']; ?>" data-original="<?php echo ut_resize( $member['ut_member_pic'] , 560 , ( $avatar_style == 'ut-circle' ? 560 : 420 ), true , true , true); ?>" > </a> </figure> PHP: So, is outputting three images within a anchor tag and the link of the Url of each image. What I want to do is : assign a link to each image, for example: image one : www.mysite.org/scott-garret image two : www.mysite.org/brian-adams image three : www.mysite.org/jim-morrison To do that I want to replace the $member['ut_member_pic'] with a function call. I want to create a function in function.php that does something like this: function function add_link_to_photo() { if ($member['ut_member_name'] = (’Scott Garret’)){ echo $scott_garret_link ; } ifesle ($member['ut_member_name'] = (’Brian Adams’)){ echo $brian_adams_link ; } ifesle ($member['ut_member_name'] = (’Jim Morrison’)){ echo $jim_morrison_link ; } PHP: Then I will change the file in something like this : <?php $member_ID = $ut_global_member_count; foreach ( $team as $key => $member ) : $clear = ''; ?> <div class="member-box ut-member-style-3 <?php echo $ut_member_box_size; ?> <?php echo $grid[$ut_member_in_row]['class']; ?>"> <?php $avatar_style = 'ut-square'; ?> <?php //$avatar_style = $member['ut_avatar_style']; ?> <div class="mp-holder"> <?php if(!empty( $member['ut_member_pic'] )) : ?> <figure class="member-photo-style-3"> <?php $jim_morrison_link =‘jim-morrison’; $brian_adams_link =‘brian-adams’; $scott_garret_link = ‘scott-garret’; ?> <a href="<?php add_link_to_photo() ?>"> <img class="utlazy" src="<?php echo THEME_WEB_ROOT; ?>/images/placeholder/team-member.png" alt="<?php echo $member['ut_member_name']; ?>" data-original="<?php echo ut_resize( $member['ut_member_pic'] , 560 , ( $avatar_style == 'ut-circle' ? 560 : 420 ), true , true , true); ?>" > </a> </figure> PHP: So… by doing this nothing is working, all stuck! For sure tons of syntax errors and probably a lot more, I apologize for that, I’m here for learn. Thanks in advance.
This should fix a good few of your errors. Run that see what happens. Note the changes in RED <?php $member_ID = $ut_global_member_count; foreach ( $team as $key => $member ) Replace : with ; $clear = ''; ?> <div class="member-box ut-member-style-3 <?php echo $ut_member_box_size; ?> <?php echo $grid[REMOVE DOLLAR SIGN$ut_member_in_row]['class']; ?>"> <?php $avatar_style = 'ut-square'; ?> <?php //$avatar_style = $member['ut_avatar_style']; ?> <div class="mp-holder"> <?php if(!empty( $member['ut_member_pic'] )) Replace : with ; ?> <figure class="member-photo-style-3"> <a href="<?php echo $member['ut_member_pic']; ?>"> <img class="utlazy" src="<?php echo add here $THEME_WEB_ROOT; ?>/images/placeholder/team-member.png" alt="<?php echo $member['ut_member_name']; ?>" data-original="<?php echo add here $ut_resize( $member['ut_member_pic'] , 560 , ( $avatar_style == 'ut-circle' ? 560 : 420 ), true , true , true); ?>" > </a> </figure> <?php $member_ID = $ut_global_member_count; foreach ( $team as $key => $member ) Replace : with ; $clear = ''; ?> <div class="member-box ut-member-style-3 <?php echo $ut_member_box_size; ?> <?php echo $grid[REMOVE DOLLAR SIGN$ut_member_in_row]['class']; ?>"> <?php $avatar_style = 'ut-square'; ?> <?php //$avatar_style = $member['ut_avatar_style']; ?> <div class="mp-holder"> <?php if(!empty( $member['ut_member_pic'] )) Replace : with ;?> <figure class="member-photo-style-3"> <?php