简体   繁体   English

如何在WordPress中将单个帖子链接到thickbox?

[英]How to link single post to thickbox in WordPress?

How can I link single.php to open in thickbox? 我该如何链接single.php在Thickbox中打开?

I know I have to add class="thickbox" to the permalink - but how do I link post content with it? 我知道我必须在永久链接中添加class="thickbox" -但是我该如何链接帖子内容?

I tried creating a hidden div containing the stuff I want the popup to display and then link to the div ID but I didn't think this through because this method shows a clone of the whole page you're on just inside the thickbox. 我尝试创建一个隐藏的div其中包含我希望弹出窗口显示的内容,然后链接到div ID,但我没有想到,因为此方法显示了整个页面的克隆,而该页面只是在thickbox内。 Not what I want. 不是我想要的

But if you just add class="thickbox" to the permalink which is supposed to bring you to the single post you just get an empty thickbox. 但是,如果您只在永久链接中添加class="thickbox" ,这将使您进入单个帖子,您只会得到一个空的thickbox。

Any suggestions on how to show more detailed post content in thickbox? 关于如何在thickbox中显示更详细的帖子内容有任何建议吗? Help would be very much appreciated. 帮助将不胜感激。

I found a solution to show the content of single.php in a fancybox popup. 我找到了一种在fancybox弹出窗口中显示single.php内容的解决方案。

I removed get_header and get_footer from my single.php but included wp_head and wp_footer in order to load stylesheets and scripts. 我从single.php中删除了get_headerget_footer ,但为了加载样式表和脚本,包括了wp_headwp_footer

Then I downloaded Easy Fancybox for WordPress and enabled Iframe content. 然后,我下载了适用于WordPress的Easy Fancybox并启用了iframe内容。

The links to my single posts opening in fancybox now look like this: 现在,指向我在fancybox中打开的单个帖子的链接如下所示:

<a class="fancybox-iframe" href="<?php the_permalink(); ?>">Open Single Post in Popup</a>

Just in case anybody's trying to achieve the same thing. 以防万一有人试图实现同一目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM