okiwan
Forum Replies Created
-
Nice to know, thanks. I will be keep an eye once the version goes to production.
Best regards,
SergioForum: Plugins
In reply to: [Simple Lightbox] Make it work on using 'get_the_content()'?All right, I think I found a solution. Of course it’s not an elegant one, but at least it works flawlessly on any situation and avoid any kind of coupling (if this is a right term) between my theme and the plugin.
The problems is that, by using
get_the_content(), WordPress does not apply any filters to it. It only does it usingthe_content(). So, what we are going to do is use it.As we know the_content prints on screen but, what happens if we put this onto a temporary buffer? PHP function
ob_start()creates an output buffer, which will held the contents without displaying them, and those contacts will be affected by the filters for sure. Finally, we will callob_get_clen()to retrieve and store them in a variable and clean the buffer. Pretty neat. Here’s all together:// Whatever you have to do here...loop, etc. ob_start(); the_content(); $theOutput = ob_get_clean(); // ...whatever you have to do with the output, now with all filters applied (and, on this case, with lightbox working flawlesslyCheers!
Never mind, I just saw it’s my fault. Wrong way to structure the page, so it’s obvious JetPack won’t work with it 😛
Sorry for the spam.
Cheers!