I am setting up a wordpress website and want to alter a plugin to work with another so that when a news link is clicked it will open in a lightbox using an iframe. I believe the following instances to be where the link is made.
<a href="<?php echo $link; ?>
I am looking to add the following to the link, at the end.
?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]"
I am unsure of how to combine the two. I am hoping by doing so that I correctly located and understood what needed to be changed. If you want to see the full PHP file I have added it to http://pastebin.com/sFqSb1Ha
While I wouldn't mind someone telling me the answer, I would be happy to just be pointed in the right direction for the knowledge I need to study to accomplish this.
I can see that there are a lot of $link
echos in the code you provided. To apply that attrubute for all, you may set $link
before, like:
$link = $link . '?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]';
(Note that "
at the end is missing, because it's already provided in href=""
).
But if you want to use it for a single link, try
<a href="<?php echo $link; ?>?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" ...
There is just a little problem. If in $link
there are parameters in URL, it will fail, because any other param must start with &
, and we have ?iframe
there. So it's good to check, whetever the ?
sign occurs in $link
or not.
if (strpos($link, '?') > 0)
$link = $link . '&iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]';
else
$link = $link . '?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]';