Martijn Haring Martijn Haring - 1 month ago 6
PHP Question

How to link to different div in div

I want to change the area which responds as a link. The page output is a grid of circles with my team members in it. Currently the text which appears when hovering over with my mouse is clickable, i want to change it to the whole inner circle. The piece of code where it is stated is as follows:

So the div sc_team_member_inner needs to link in stead of sc_team_member_name.

Sorry for the very basic PHP question.. Thanks in advance!

<?php
if ( $members->have_posts() ) {
while ( $members->have_posts() ) {
$members->the_post();
?>
<div itemscope itemtype="http://schema.org/Person" class="sc_team_member">
<div class="sc_team_member_inner">

<?php
if ( has_post_thumbnail() )
echo the_post_thumbnail( 'medium' ) ;
else {
echo '<img src="' . SC_TEAM_URL . 'inc/img/noprofile.jpg" class="attachment-medium wp-post-image"/>';
}
?>

<?php if ( 'yes' == $this->options[ 'name' ] ) : ?>
<div itemprop="name" class="sc_team_member_name">
<a href="<?php the_permalink() ?>" rel="bookmark" class="<?php echo $this->check_clicker( $single_template ); ?>">
<?php the_title() ?>

Answer

Here is an example of what I think you want?

.sc_team_member_name {
  height: 10em;
  width: 10em;
  border-radius: 50%;
  border: 2px solid black;
}
.sc_team_member_name a {
  display: block;
  height: 100%;
  width:100%;
  text-align: center;
  border: 1px solid red;
  border-radius: 50%;
}
a:hover {
  background: rgba(255,0,0,0.5);
}
<div itemprop="name" class="sc_team_member_name">
  <a href="link_to_person" rel="bookmark"> </a>                           
</div>

Comments