Single media lightbox opens with sidebar template included


#1

Hi guys,

Amazing work on the plugin! Does exactly what’s expected and easy to customise :slight_smile:

I’m having an issue with the lightbox not correctly opening single media. It DOES open it but additionally loads everything else on the page again. I’m not 100% sure what’s happening but it seems that the AJAX request is doing something it isn’t supposed to do.

You can see a live example of the issue here: http://cfcommunity.staging.wpengine.com/members/cfcommunity/media/

I’m using a custom theme based on Roots (http://roots.io/).
One thing that could potentially cause issues is the wrapper system Roots uses: http://roots.io/an-introduction-to-the-roots-theme-wrapper/

Thanks in advance :slight_smile:
Bowe


#2

Hi Bowe,

Thanks for your valuable feedback, I appreciate it :slight_smile:

Answer to your issue, check this doc -> https://rtcamp.com/rtmedia/docs/developer/templating-system/theme-media-tab/ and apply solution suggested there.

Let me know if that works or not.


#3

Hi Ritesh,

I tried all the suggestions on that page but no results… Anything else I can try?


#4

I’m pretty sure the problem is related to this file https://github.com/CFCommunity-net/roots/blob/master/lib/wrapper.php

This seems to hijack the way you guys serve the main template. Even adding the proposed filter seems to have no results.


#5

Any suggestions to solve this guys? I would really love to use this plugin :slight_smile:


#6

Hi Bowe,

Yes you are right, it is hook priority issue. If you call rtMedia template hook -> https://github.com/rtCamp/rtMedia/blob/master/app/main/routers/RTMediaRouter.php#L40 at priority 100 than it will work completely fine.

Another way is to check the value of $rt_ajax_request global variable in theme’s base.php file and if it is true than do not load header, footer and sidebar, just load the template.


#7

Got it solved! Thank you!

In case anyone stumbles upon this issue with BuddyPress Media and a Roots based theme. Check out this snippet:

Cheers,
Bowe


#8

Hi Bowe,

According to that if condition , if you disable rtMedia plugin than it won’t load header, footer and sidebar because it won’t find rtmedia_autoloader function.

I suggest some thing like following,

global $rt_ajax_request;  
 if( isset( $rt_ajax_request ) && $rt_ajax_request ){  
	include roots_template_path();  
 } else {  
	// load header, footer ,sidebar and template (actual code of base.php file)  
}

#9

You’re right :slight_smile: Thank you, works a treat!


#10

Hi @bowefrankema,

You are welcome. Feel free to create new support request if you found any issue.


#11