Jump to content

Archived

This topic is now archived and is closed to further replies.

RunningTexan

Adding Link to Media Box

Recommended Posts

RunningTexan

One last question.  Where can I add code to add a hyperlink to an entire media box?

Share this post


Link to post
Share on other sites
Jake

Hi RunningTexan - you'll want to modify this code to your specific image url and link url:

 

<a href="yourlink.html"><img src="path/toyour/image/image.jpg"></a>

 

and then enter your code in this area of the MediaBox settings http://d.pr/i/31Tg/


Have you searched the forums yet or checked out the DMS user docs?

PageLines geek, blogging at MyUntangledLife.com

Share this post


Link to post
Share on other sites
chrisburbridge

This means you'd have to no longer use the image box, but put all the HTML for the link, image, etc., in that lower embed/HTML box. Seems like it would be very in keeping with PageLines style to simply add an option to make images linkable, as this is a very common feature.

Share this post


Link to post
Share on other sites
Danny

chrisburbridge

 

Thanks for the feedback, I will add this feature request to our tracker.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
globalnative

I would like to add a request for this please, it makes total sense!

Share this post


Link to post
Share on other sites
Danny

Thanks for sharing.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
asialove

One last question.  Where can I add code to add a hyperlink to an entire media box?

 

edit the /sections/mediabox/section.php

 

Add below code:

array(
'type'  => 'text',
'key' => 'mediabox_link',
'label'  => __( 'Link', 'pagelines' ),
'help' => __( 'please have http:// for example: http://google.com' )
),

under the 

 

array(
'type'  => 'textarea',
'key' => 'mediabox_html',
'label'  => __( 'Text and Embed HTML', 'pagelines' ),
'help' => __( 'Enter rich media "embed" HTML in this field to add videos, etc.. instead of an image.', 'pagelines' )
),

and then  Add this 

echo '<a href="'.$link.'">';

Above the code:

 

printf(
'<div class="mediabox-wrap %s pl-animation fix" %s style="%s%s">

and then add 

</a>

Above the 

join(' ', $classes), 

Your code should looks like this:

 

$html = do_shortcode( wpautop( $media_html ) );


$height_sync_data = (pl_draft_mode()) ? 'data-sync="mediabox_height" data-sync-mode="css" data-sync-target="min-height" data-sync-post="px"' : '';
echo '<a href="'.$link.'">';
printf(
'<div class="mediabox-wrap %s pl-animation fix" %s style="%s%s">
<div class="the-media fitvids pl-centered %s hentry">
%s%s
<div class="the-media-html">%s</div>
</div>
</div></a>', 
join(' ', $classes), 
$height_sync_data,
$bg, 
$height, 
$align_class,


$img, 
$title,
$html

 

Share this post


Link to post
Share on other sites
greenfly
No need to do this. You can wrap your content in rich HTML.

<a href="link">
Your Content/image </a>

The answer to many issues can be found by searching in the forum before posting as someone else  may very well have had the same problem before you have.  Also, reading the documentation can help you gain a good understanding of how everything works. 

 

Please do not send me private messages. Occam's razor - The principle states "Keep things simple!"

Share this post


Link to post
Share on other sites
LECDelhi

Can this be a feature request? Still Media Box doesn't have this feature. It would be a great help if it has that feature.

Share this post


Link to post
Share on other sites
Buishi

Agreed, I was surprised to not see a link option for media box.

Share this post


Link to post
Share on other sites
chuckrose1

I could not agree more. I am spending way too much time trying to hyperlink an image. Please put this at the top of your Feature Request list.


Chuck Rose

VP, Design & Development

Ballantine Communications, Inc.

Share this post


Link to post
Share on other sites
Danny

Not sure why it would take so much time adding a link to an image ? Its really basic and quick to write HTML ?

 

<a href="" target="_blank" title="">

  <img src="" alt="">

</a>


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

×