Loading wordpress page content in colorbox Iframe

2019-08-16 02:31发布

问题:

I'm building a Wordpress site using the colorbox plugin. I'm using text-links which open a webpage in an Iframe. That works fine.

But now, I want to load the content of a certain wordpress page in it, particular an Item portfolio page created with the Nimble portfolio plugin.

I think I have to use some basic code like

<a href="<?php echo get_page(36)->post_content; ?>" class="colorbox-link">Contact</a>

but I can't fix it.

Any suggestions?

回答1:

Thanks for your sympathizing comments on my first question on stackoverflow. I'm sorry if my question wasn't clear enough, but the site where the problem shows up is still in development.

But fortunately I've figured it out after a long time:

Next to single.php I created a singe-portfolio.php file, because because of the Wordpress hiërarchy, WordPress finally looks for singe-{filetype}.php.

In the Nimble Portfolio Loop, I linked to this file with the following code:

<a href="<?php echo 'http://siteurl/?p='.$post_id; ?>" class="button-fixed colorbox-link">...</a>

In the single-portfolio.php file, I used a regular WordPress loop to get the page content in the JQuery Colorbox Iframe.

Hope this will help someone else!