-
AuthorPosts
-
August 16, 2014 at 3:09 pm #86106
Hello Theme X people,
I got an odd thing, not sure where the issue is. I am trying to get gallery + lightbox work.
The code I use is for instance:
[gallery link="file" ids="94,70,96,69,100"] [lightbox selector=".gallery-icon > a"]
This works fine if I use the following:
1) add new post/page
2) use classic mode visual editor
3) copy and paste the above code (or follow your instruction adding gallery)BUT.. if I do the following
1) add new post/page
2) use back end mode visual editor
3) add element: text
4) copy and paste the following code (or follow your instruction adding gallery) both in visual and text mode.Then NO lightbox, it just opens the picture.
Live testing at http://amaravati.org.gridhosted.co.uk/photo/
Is this a limitation in using Visual editor with lightbox+gallery? Because not using visual editor it works. (I have all my pages done using visual editor, would be great to add some pictures with lightbox)
Please help,
Thank you
August 16, 2014 at 7:35 pm #86149Hey there,
When you use Visual Editor, the lightbox script doesn’t work because > is converted to > (see http://prntscr.com/4djmq4). What you can do is take out the lightbox shortcode in the Visual Editor and add Lightbox Element separately. Or, you can try adding the code below in your functions.php.
function stop_gt_conversion( $content ) { $new_content = ''; foreach( preg_split( '/((\r?\n)|(\r\n?))/', $content ) as $line ) { $new_content .= preg_replace( '/^>/', '>', $line ) . '\r\n'; } return $new_content; } add_filter( 'the_content', 'stop_gt_conversion', 1 );
This doesn’t happen on our end. So this might be due to your setup.
Thanks.
August 17, 2014 at 1:19 pm #86396Hello,
first of all thanks! I did figured out it is the conversion, but didn’t know whether it ‘should’ be working.
I find a way how it could work using the Visual Editor. It seems that as soon as I put anything with a > in the text or lightbox element, convert this into > (see many issues reported).
Before saving/updating the post/page (using the procedure described above in my first post)
1) click on Classic Mode Visual Editor
2) click on text (not visual mode)
3) manually change& g t ;
into >
4) save/updateNow it will hold the > correctly without converting
Optionally:
5) click on backend mode on Visual Editor
6) save/update (now it will somehow not convert the > sign, and saves it correctly)That keeps the setting in WordPress in >, rather than
& g t ;
.* is have written & g t ; –> this is without spaces in real life, because this forum also converts these into >
Your last line is:
This doesn’t happen on our end. So this might be due to your setup.
Does this means that visual editor should not be converting the > sign? (so where should I look to check the fault in ‘wordpress or database?’)
Thanks!
August 17, 2014 at 4:58 pm #86468Hi there,
If you will add raw html content with
<
and>
in Visual Mode, then it will be converted to their html entities like<
and>
. While raw html will be preserved when using Text Mode.But you’re adding a shortcode with a string of
>
and not as html, and shouldn’t be converted to html. Which we have no issue adding string>
on our end.Any content added within element attribute are considered string, so not sure why would editor convert that. Or could it be your browser? It happens once before while I’m using chrome.
Thanks!
August 18, 2014 at 4:17 am #86737Hello,
Strange isn’t it? I tried using Safari, rather than Chrome, the issue still persist. I am surprised you don’t have this issue when using visual composer and adding this gallery lightbox code.
Whenever saving when the Visual Composer is still enabled on the post/page, it converts this > tag. When I first edit the page in Visual Composer and then disable this afterwards before saving, then it is ok.
It seems to be an issue with Visual editor or WordPress itself (or combination).
I guess one of the way out is to copy and paste the code you provided, I am reluctant to change these stuff in functions.php becuase it might break things or make other things not workable in the future.
I really appreciate your response and help so far.
Thanks!!
August 18, 2014 at 6:15 am #86764Hi There,
Its’ an issue with VC, however you need to follow the second trick you described above. We’re not the original author of VC plugin. From our side we’ll inform the issue to them soon.
Thanks for your co-operation, Have a nice day!
August 18, 2014 at 12:39 pm #86990Hello X,
thanks for confirming the issue is currently with VC. Thanks as well to inform them.
At least I don’t have to dive into my wordpress installation!
Thanks for spending time to help me out.
Bye!
August 18, 2014 at 1:20 pm #87016Glad we were able to help. 🙂 Have a nice day.
-
AuthorPosts