Results 1 to 5 of 5
-
4th Apr 2012, 05:51 PM #1OPMemberWebsite's:
mkspot.orgWordpress - PDF using Thickbox
Hello,
I`m using
Display PDF using Thickbox in a WordPress plugin. Plugin work great until you put three pdf file in one page and then will show you only one(first pdf file link - this mean when you click on other link you will se only the first pdf document other is not showed). So i found this code to show multiple pdf`s
Code:function ilc_pdfbox_thecontent ($content){ global $post; global $pdfbox_width; global $pdfbox_height; $pdfbox_height_plus = $pdfbox_height + 15; $pdfbox_height += 35; $pattern = "/<a>]*).(pdf)('|\")(.*?)>(.*?)/i"; $replacement = '<a href="#TB_inline?height='.$pdfbox_height.'&width='.$pdfbox_width.'&inlineId=ilc_pdfbox_##" rel="nofollow">Launch PDF file.</a> '; preg_match_all($pattern,$content,$matches); foreach($matches[0] as $k=>$v){ $new_v = preg_replace($pattern, $replacement, $v); $new_v = preg_replace("!##!", $k, $new_v); $content = preg_replace("!".preg_quote($v)."!", $new_v, $content); } return $content; }
here is orginal code
Code:function ilc_pdfbox_thecontent ($content){ global $post; global $pdfbox_width; global $pdfbox_height; $pdfbox_height_plus = $pdfbox_height + 15; $pdfbox_height += 35; $pattern = "/<a(.*?)href=('|\")([^>]*).(pdf)('|\")(.*?)>(.*?)<\/a>/i"; $replacement = '<a href="#TB_inline?height='.$pdfbox_height.'&width='.$pdfbox_width.'&inlineId=ilc_pdfbox_content" class="thickbox pdfbox">Launch PDF file.</a> <div id="ilc_pdfbox_content" style="display:none;"><iframe class="ilc_pdfbox_iframe" src="$3.$4" style="height:'.$pdfbox_height_plus.'px;"></iframe></div>'; $content = preg_replace($pattern, $replacement, $content); //} return $content; }
NightLightW Reviewed by NightLightW on . Wordpress - PDF using Thickbox Hello, I`m using Display PDF using Thickbox in a WordPress plugin. Plugin work great until you put three pdf file in one page and then will show you only one(first pdf file link - this mean when you click on other link you will se only the first pdf document other is not showed). So i found this code to show multiple pdf`s function ilc_pdfbox_thecontent ($content){ global $post; global $pdfbox_width; global $pdfbox_height; $pdfbox_height_plus = $pdfbox_height + 15; Rating: 5
-
4th Apr 2012, 07:55 PM #2Banned
i got the same problem too. anyone help?
-
5th Apr 2012, 01:57 AM #3Respected MemberWebsite's:
DL4Everything.com Soft2050.inThere seems to be an error in the $pattern, the default pattern would also work fine to match hrefs ending with .pdf so
PHP Code:function ilc_pdfbox_thecontent ($content){
global $post;
global $pdfbox_width;
global $pdfbox_height;
$pdfbox_height_plus = $pdfbox_height + 15;
$pdfbox_height += 35;
$pattern = "/<a(.*?)href=('|\")([^>]*).(pdf)('|\")(.*?)>(.*?)<\/a>/i";
$replacement = '<a href="#TB_inline?height='.$pdfbox_height.'&width='.$pdfbox_width.'&inlineId=ilc_pdfbox_##" rel="nofollow">Launch PDF file.</a>';
preg_match_all($pattern,$content,$matches);
foreach($matches[0] as $k=>$v){
$new_v = preg_replace($pattern, $replacement, $v);
$new_v = preg_replace("!##!", $k, $new_v);
$content = preg_replace("!".preg_quote($v)."!", $new_v, $content);
}
return $content;
}
-
5th Apr 2012, 01:42 PM #4OPMemberWebsite's:
mkspot.orgi change the code with your code soft2050 - thanks for help
and i try to open...only url made changes and no open pdf box
i dont know what to do why is this problem....
-
7th Apr 2012, 12:32 PM #5OPMemberWebsite's:
mkspot.orgOK. I found the solution for my problem using other plugin.
Lightbox Plus is really good plugin. You can use for gallery and also if you check
you will have other options like
to show pdf doc i use this link
Using Secondary Lightbox for External Content
Code:<h4 style="text-align: center;">♦ Електрични апарати и уреди ←→ <a class="lbpModal" title="Електрични апарати и уреди" href="http://www.matura.gov.mk/data_files/state_graduate/mk/0638_Elektricni%20aparati%20i%20uredi.pdf"> Here put name to be hyper link</a></h4>
you need only in hyper link to put class="IbpModal" - and you can have how much you want pdf doc.
this is really cool
if you have any question about this you can ask me
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Wordpress Article Fetch [Aka Wordpress leecher!]
By S?nic in forum Webmaster ResourcesReplies: 2Last Post: 11th Apr 2012, 06:48 PM -
2 themeforest Wordpress themes☼Converting A PSD To WordPress☼
By chemicalx in forum Completed TransactionsReplies: 0Last Post: 21st Feb 2012, 01:15 PM -
Wordpress error when disable Wordpress Seo by Yoast
By chipve in forum Webmaster DiscussionReplies: 8Last Post: 8th Jul 2011, 07:11 PM -
[Hiring] Expert Wordpress Coder (Wordpress Guru)
By MasterDKR in forum Completed TransactionsReplies: 0Last Post: 2nd Aug 2010, 05:07 PM -
[Buying] Wordpress to Wordpress Post Leecher
By gcs89 in forum Completed TransactionsReplies: 1Last Post: 23rd Jul 2010, 11:45 PM
themaCreator - create posts from...
Version 3.45 released. Open older version (or...