Lightbox loading entire page template inside of it

Hi guys,

I’m a WordPress PHP dev working on a buddypress site for a client. This is certainly a theme issue, the plugin works perfectly okay with the default theme. Hoping you might be able to point me in the right direction. I don’t expect you to wrestle with our theme issues.

At first, the theme was loading the rtmedia gallery with a single blog post template, so things would display wrong. I applied this fix, which did loaded up the page template and now the gallery displays:

add_filter('rtmedia_main_template_include', 'rtmedia_main_template_include', 20, 2);  
function rtmedia_main_template_include($template, $new_rt_template) {  
	return get_page_template();  

However, when an image is clicked, it loads the entire page template inside the lightbox. There are no extra javascript errors in the console to give us any clues.

Anything I should check? Any clues or directions I should go?

I can’t provide a fault URL because the entire site needs to remain password protected. Can arrange for an admin account over private message/email if necessary.

Debug Info:
Home URL
Site URL
PHP 5.4.26-1~dotdeb.0
MYSQL 5.5.31
WordPress 3.8.1
BuddyPress 1.9.1-7716
rtMedia 3.6.11
OS Linux
Imagick Not Installed
GD bundled (2.1.0 compatible)
[php.ini] post_max_size 40M
[php.ini] upload_max_filesize 40M
[php.ini] memory_limit 256M
Installed Plugins VaultPress by Automattic version 1.5.5,
Debug Bar by wordpressdotorg version 0.8.1,
Activity Sticker by imath version 1.0-beta3,
AutoBlog by Barry (Incsub) version,
BadgeOS BadgeStack Add-On by Credly version 1.0.1,
BadgeOS BP Profile Ring Color by My Blogilates version 1.0,
BadgeOS Community Add-On by Credly version 1.1.1,
BadgeOS by LearningTimes version 1.3.5,
bbPress by The bbPress Community version 2.5.2,
Blogilates Social Media by Blink Web Effects version 1.0,
BP-Album by The BP-Media Team version,
BuddyPress Moderation by Francesco Laffi version 0.1.7,
BP Profile Search by Andrea Tarantini version 3.5.3,
BuddyPress Activity Plus by Ve Bailovity (Incsub), designed by Brett Sirianni (The Edge) version 1.5,
BuddyPress Docs by Boone B Gorges version 1.5.6,
rtMedia for WordPress, BuddyPress and bbPress by rtCamp version 3.6.11,
BuddyPress Profile Mapper by Marshall Sorenson (MrMaz) version 1.0,
BuddyPress Toolbar by David Decker - DECKERWEB version 1.6.0,
Buddypress Xprofile Custom Fields Type by donmik version,
BuddyPress by The BuddyPress Community version 1.9.1,
CubePoints Buddypress Integration by Tosh Hatch version,
CubePoints by Jonathan Lau & Peter Zhang version 3.2.1,
Debug Bar Extender by Thorsten Ott, Automattic version 0.5,
Debug Bar Template Trace by Clorith version 0.1.2,
The Events Calendar PRO by Modern Tribe, Inc. version 3.2,
Export User Data by Q Studio version 0.7.8,
Flickr - Pick a Picture by Pablo Adrian Castillo version 1.2.4,
Gravity Forms by rocketgenius version 1.8.5,
Gravity Forms User Registration Add-On by rocketgenius version 1.7,
Gravity Forms Infusionsoft Add-On by Katz Web Services, Inc. version,
Invite Anyone by Boone Gorges version 1.0.25,
The Events Calendar by Modern Tribe, Inc. version 3.3.1,
Ultimate Branding by Barry (Incsub), Andrew Billits, Ulrich Sossou, Ve Bailovity (Incsub), Marko Miljus (Incsub) version 1.4.1,
Use Google Libraries by Jason Penney version 1.5.2,
User Synchronization by Andrey Shipilov (Incsub), Cole (Incsub), Maniu (Incsub) version 1.1.3,
WordPress Importer by wordpressdotorg version 0.6.1,
WordPress Social Login by Miled version 2.1.5,
WordPress Database Backup by Austin Matzko version 2.2.4,
WPMU DEV Dashboard by Aaron Edwards (Incsub) version 3.4.1,
WPSmart Mobile by WPSmart version 1.0.4
Theme Name Razor BuddyPress Theme
Theme Version 1.1.5
Author URL
Template Overrides plugins/buddypress-media/templates/media/album-gallery-item.php,
Total Albums 1
Total Photos 4


Check rtMedia with other plugins disabled. If that didn't work, send login details to so that I can have a look.

This is resolved. Ritesh gave us a quick snippet to check if the rtmedia plugin was using an ajax request when the template_include filter was being ran. Threw this in the callback for the template_include filter in our theme that wanted to load its own template:

//** RTMEDIA FIX **// global $rt_ajax_request; if ( isset($rt_ajax_request) && $rt_ajax_request === true ){ return $template; } //** E.O.RTMEDIA FIX **//

Thanks for you help! You guys have really good support here. Kudos. :)

Glad to hear that the issue has been fixed.