Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activation of Gantry modules (rendered with Timber/Twig) #856

Open
andreascarfo opened this issue Jan 11, 2021 · 9 comments
Open

Activation of Gantry modules (rendered with Timber/Twig) #856

andreascarfo opened this issue Jan 11, 2021 · 9 comments

Comments

@andreascarfo
Copy link

Description of Problem

On a homepage I'm inserting some photos out frome the main content

and I'd like those photos to open in a lightbox.
I tryed to replicate the same code inside the main container of the page and the lightbox would work there.
But I would need to use more sections.

I enabled all options in "activation" options.

Details

  • https://www.erraredesign.it/front-page/
  • Both Firefox and Chrome
  • SLB Installed: 2.8.1
  • Other plugins installed: I tryed to disable all the unnecessary ones, so I kept active only: Gantry (my framework)
    Anyway these are my plugins:
  • Akismet
  • Campi Personalizzati Avanzati
  • Classic Editor
  • Enable jQuery Migrate Helper
  • Gantry 5 Framework
  • Get Custom Field Values
  • heatmap for WordPress
  • HTML Editor Syntax Highlighter
  • Meow Gallery
  • Post Slider and Carousel with Widget
  • SG Optimizer
  • Simple LightboxSettings
  • Smash Balloon Instagram Feed
  • Visual Editor Custom Buttons
@archetyped
Copy link
Owner

Hi, you can manually activate links to be displayed in a lightbox using SLB's slb_activate() template tag. See SLB's Activation documentation for full details.

@andreascarfo
Copy link
Author

I can't understand how to use this function in html.
Maybe I was not able to look in documentation.

@archetyped
Copy link
Owner

Please do not create duplicate issues. You can add comments to existing tickets and they can be reopened if necessary.

Please provide more information on where and how you are attempting to use SLB. Your initial post said "out frome the main content", but your later post says you want to use it "in a html page".

Like any other function in WordPress, slb_activate() can only run on a PHP page where WordPress is active, so standard HTML pages will not be supported by any WordPress functionality. If you are actually referring to a theme template page, please provide the template's code (in a code block for proper formatting), and I will take a look.

@andreascarfo
Copy link
Author

andreascarfo commented Jan 21, 2021

I was worry because you decided to close this issue without my consent, without solving the problem.

Anyway in my workspace I can build sections out from main content pages and I can add widget or other component. In my case I have to add some stupid HTML code that will be the same in all the pages with that template (it's not importat if this will be one page or many).
So, it's not a variable, there is not any Wordpress functionality, but only some stupid HTML code.

In other plugins I can specify a selector (id or class) to activate the lightbox.
Other ones can...

<section id="expanded">
<div>
  <a href="https://www.erraredesign.it/wp-content/uploads/ErrareDesign-EcoFactory_noteplant_08-2143.jpg" class="mylbox" style="">
<img loading="lazy" class="alignleft size-medium wp-image-200 mwl-img" 
src="https://www.erraredesign.it/wp-content/uploads/ErrareDesign-EcoFactory_noteplant_08-2143-267x400.jpg" 
alt="" srcset="https://www.erraredesign.it/wp-content/uploads/ErrareDesign-EcoFactory_noteplant_08-2143-267x400.jpg 267w, https://www.erraredesign.it/wp-content/uploads/ErrareDesign-EcoFactory_noteplant_08-2143-768x1152.jpg 768w, https://www.erraredesign.it/wp-content/uploads/ErrareDesign-EcoFactory_noteplant_08-2143.jpg 853w" sizes="(max-width: 267px) 100vw, 267px" 
data-mwl-img-id="200" mwl-index="1" width="267" height="400">
</a>
</div>
</section>

In this case I used the class "mylbox" as activation selector.

If this feature will be created I will be happy to go back and use SLB.

Thanks in advance.

@archetyped
Copy link
Owner

archetyped commented Jan 21, 2021

The ticket was closed because the question was answered based on the information provided in the original post. Providing all necessary information is the best way to ensure your actual question is answered before a ticket is closed.


Can you please clarify what you mean by "workspace"? Is the HTML code added to a template in the WordPress theme, or somewhere else (e.g. via a plugin, etc.)?

Thanks.

@andreascarfo
Copy link
Author

andreascarfo commented Jan 21, 2021

When I say workspace I mean Gantry5.
It is workspace that came with a plugin, a theme and a child theme.
In the backend the workspace ambient is opened inside a plugin area, not in the defult wordpress aspect area.
You can give a look here
http://docs.gantry.org/gantry5/configure/gantry-admin

@archetyped
Copy link
Owner

Thank you for the additional information. What specific section of the Gantry admin you adding the HTML? If Gantry supports filters, it may be possible to activate links in HTML added to Gantry.

Also, please provide a link to the specific theme you are using so that your setup can be more closely reproduced.

Thanks.

@andreascarfo
Copy link
Author

Hi,
Section is #g-expanded
Gantry support in HTML particle processing shortcodes and process twig.
None of them worked.
My theme in use is a child themo of helium
http://gantry.org/downloads

Link to direct download
https://github.com/gantry/gantry5/releases/download/5.4.37/wordpress-tpl_g5_helium_v5.4.37.zip
You need to install the gantry5 plugin
https://github.com/gantry/gantry5/releases/download/5.4.37/wordpress-pkg_gantry5_v5.4.37.zip

Thank you.

@archetyped
Copy link
Owner

archetyped commented Feb 3, 2021

Thank you for the additional information. As Gantry uses Timber/Twig and generates its output differently than standard WordPress themes, making use of standard template tags is not as straightforward.

If you are familiar with Gantry's theme structure, you can use PHP's output buffering functionality to save the output of a specific component (such as your #g-expanded section) and process it with template tags such as slb_activate() before sending it to the browser.

I have also added looking into further compatibility with Gantry/Timber to the to-do list in the hope that a more native solution will be available in the future.

@archetyped archetyped changed the title not working inside a not-main <sections> Activation of Gantry modules (rendered via Timber/Twig) Feb 3, 2021
@archetyped archetyped changed the title Activation of Gantry modules (rendered via Timber/Twig) Activation of Gantry modules (rendered with Timber/Twig) Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants