Comments (4)
The following things must be ensured:
- every Pym instance on the page is initialized
Here are the solutions that I can think of:
string matching and global variables and filters to put the pymsrc
script tag at the start of the_content()
- Add a filter to
the_content
that checks for the presence of the string 'pym', and if it is there, sets a global "maybe" variable totrue
- In the pym renderer, if it is called, if the tag doesn't have its own pymsrc, set a global
definitely
variable totrue
. If pymsrc is set, then instead output the pymsrc's tag - In a filter running on
the_content
that runs at a very late priority, like100
, if $maybe and $definitely, prependthe_content
with a script tag that registers the appropriatepymsrc
.
Enqueue the new pym.Parent
in the footer
- Everytime we would output a
<script>var pym_1 = new pym.Parent('pym_1', 'https://f.benlk.com/graphics/heartbeat-abortion-bills/child.html', {})</script>
, instead of outputting it then, add it to the footer with a generated callback function that has the correct variables inserted into its call.
This doesn't move the location of the pymsrc
tag starting Pym, but it also does not prevent addressing #33 by enqueuing the pymsrc
tag in the wp_footer
as long as the function outputting that tag is enqueued at a higher priority.
from pym-shortcode.
I asked in #wordpress
on freenode IRC, and received feedback to the effect that the best place to put those script tags is in <head>
or at the end of <body>
with wp_footer
.
from pym-shortcode.
My worry is that someone using this plugin is going to be using WordPress in a way that powers a non-main-website content presentation, and their content presentation is going to render the_content()
as HTML with scripts and stuff, but without any of the dependency-satisfying code from wp_footer
.
from pym-shortcode.
Feedback in #wordpress
on newsnerdery.org Slack from several people also recommends wp_footer
.
from pym-shortcode.
Related Issues (20)
- rename text domain HOT 1
- React is dropping className for class HOT 1
- Add CONTRIBUTING.md
- contributors: inn_nerds becomes innlabs
- Tag 1.3.2.1 HOT 2
- Test against Gutenberg 4.0 and WP 5.0
- Gutenberg Block failing for me on Wordpress.com HOT 4
- Editor JS not enqueued in WordPress 5.0-beta versions HOT 2
- AMP support? HOT 6
- php error with latest version? HOT 6
- Test in Reader Mode in various browsers HOT 2
- Remove Pull Request Template from this repo so it's covered by INN's org-wide PR template HOT 2
- typo in docs: nwesroom
- Text domain corrections
- Release checklist for tagging version 1.3.2.3 HOT 2
- Update support.inn.org docs
- Release checklist for tagging version 1.3.2.4 HOT 3
- Test against WordPress 5.4 RC HOT 1
- Review `http:` strings in plugin and update to `https:` where possible
- Release checklist for tagging version [next]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pym-shortcode.