I am looping through some images of houses where all have a link to the house detail page. But i have one image that is in the that has a different link where it is being linked to the staff page.
Issue
How do i get that one link to go to the Staff detail page. I have tried to show different blocks of code depending on what class is inserted from the CMS? any suggestions?
<?php
$page_link = team;
if ( $page_link == {@page} ) {
?>
<a href="/team" class="{@remove_link} {@page}" >
<div class="project {@grey_scale} grid-item {@tile_size_width} {@tile_size_height}" style="background:url('{@image_1}{@video_image}');background-size: cover; background-position:center;">
</div>
</a>
<?php
} else {
?>
<a href="{@guid}" class="{@remove_link} {@page}" >
<div class="project {@grey_scale} grid-item {@tile_size_width} {@tile_size_height}" style="background:url('{@image_1}{@video_image}');background-size: cover; background-position:center;">
</div>
</a>
<?php
}
?>
First of all, you dont need to duplicate the whole HTML. You could just set the if
around the <a>
like:
<?php
$page_link = "team";
if ( $page_link == {@page} ) {
?>
<a href="/team" class="{@remove_link} {@page}" >
<?php } else { ?>
<a href="{@guid}" class="{@remove_link} {@page}" >
<?php } ?>
You need to know what is on {@page}
. If it's "team", then you can do your if
thing. If not, you have to adjust your $page_link
to the same of your {@page}
var.
If your team-page adress is something like stansmith.com/pages/team
, then you have to change the <a href="/team">
to <a href="/pages/team">
.
Please tell me if you need more help.