Php code for link

Hello!
So, I’m wprking on a website that’s using a php slider as you can see at www.drpacella.com/wp -

Whenever I add a link from the back end to any of the slides, a button shows up in the slide(like you con see on the first slide). I want it so that the entire slide is a link whenever I add a url, and not have a button.

I think I need to work on this section of the php file to make it happen (red line):

<?php foreach($myposts as $post){ ?>
" style="height:<?php echo $slider_height; ?>px;"> <?php
			 				?>
			 <?php if($post["title"]!=""){ ?>
				 <h1><span><?php echo $post["title"]; ?></span></h1>
				 <div class="clear"></div>
				 <?php if($post["description"]!=""){ ?><h4><span><?php echo $post["description"]; ?></span></h4><?php } ?>
				 <div class="clear"></div>
				 <?php if($post["url"]!=""){ ?><a href="<?php echo $post["url"]; ?>">
				 <?php echo $post["button_name"]; ?></a><?php } ?>
			 <?php } ?>

I can post the full php if needed. Anyone knows how to re arrange this? I believe I need to change the 'echo $post[“button_name”] ’ but I am not sure how yet!
Thankssssss in advance if you can help me!! :slight_smile:

I’m going to take a stab at this…

 From my understanding is that you have a button on the first slider that currently links to Google and the code your are showing works and your highlighting the current code that represents that button.  Now you want to wrap the A tags around the entire photo not just the little button. But you also want that little button to remain where it is.. 

You did good, but you didn’t include the full code for the foreach statement below you’re missing the the closing “}” for it. So I can’t easily give you cut and replace sample code to do what you want…

Post the full foreach loop and I can change it real fast for you.

Sponsor our Newsletter | Privacy Policy | Terms of Service