Jay
Forum Replies Created
-
The only way I know of doing this is to prevent setting the cookie in some manner. However, the cookie is actually set via javaScript, so you’d have to hook into
wp_localize_script( if that’s even possible ) and mess up the cookie name somehow.Off the top of my head I’m not entirely sure how this would be done, but I can look into it Monday.
Unfortunately I haven’t looked at the S2 Members plugin, so I’m not entirely sure how it works, but I imagine there’s some sort of
is_member()conditional you can use. Though don’t quote me on that.Once you find that in the S2 member code, you can then use the example from the wiki to just hide the dialog: https://github.com/JayWood/content-warning-v3/wiki/Dev-Documentation#hide-the-dialog-on-certain-pages-regardless-of-cookies
Again, this is geared towards developers, so if you don’t know PHP, I’m sorry 🙁
Forum: Plugins
In reply to: [Agy - Age verification for WooCommerce] How to discard some pages?There’s no way I can answer that for you, page/post IDs are unique to every site. Here’s a reference for the WP_Post object, which is
$post_objin the filter, you’ll need to look here for other properties if post ID is inadequate: https://codex.wordpress.org/Class_Reference/WP_PostThere’s a LOT more going on than just this plugin according to this speed test.
Additionally, this plugin ONLY adds a JavaScript to the footer, and an options panel. 99% of the functionality is in JavaScript to calculate cookies, etc, and in-turn, it’s handled by your browser, not the server.
The Code however, is open source, so feel free to open PRs if you feel the code isn’t as optimized as it should be: https://github.com/JayWood/content-warning-v3
With the current JavaScript library it is not possible no.
You should just put a URL in the enter field of the plugin settings.
Forum: Plugins
In reply to: [Agy - Age verification for WooCommerce] How to discard some pages?If you want it on specific pages only, you will need to disable site-wide in the settings, and select individual pages.
Or, if you’re abit devvy, you can do this: https://github.com/JayWood/content-warning-v3/wiki/Dev-Documentation#hide-the-dialog-on-certain-pages-regardless-of-cookies
Not off the top of my head, but sounds like I’ve mixed up conditionals. Should have a patch by monday, if not at least a response here.
GeoIP usually requires connections to IP databases or APIs. While it is definitely do-able, it’s more of an edge-case and is out of the scope of the plugin.
To do this, you can use GeoIP APIs ( google it, they’re everywhere ) and use the cwv3_should_gate filter to determine rather or not to show the dialog – more on that here: https://github.com/JayWood/content-warning-v3/wiki/Dev-Documentation#hide-the-dialog-on-certain-pages-regardless-of-cookies
As with most API’s there are rate-limits to consider, so a level of caching will probably be necessary.
I hope that points you in the right direction because I don’t think I’ll be incorporating that into the code anytime soon.
Forum: Hacks
In reply to: The customizer API, there is a plugin?To this date, I don’t know of any plugins which allow you to ‘easily’ add fields to The Customizer, and for that reason I’m definitely going to watch this thread!
I do realize that page is QUITE long, but don’t let that discourage you. At minimum you only need
add_settingandadd_controlI would start out with those, and when you feel like you’re comfortable with your understanding of them, start to play with panels and sections.Usually, add_section, add_setting and add_control are more than enough to get you going on theme options.
Forum: Hacks
In reply to: Hook post all core and plugin updatesRobert – the main problem you’re going to have is firing your git update script.
Anyhow, the action you’re looking for is
automatic_updates_completeThe class that’s fired for an automatic update isWP_Automatic_Updater::run()and is located inwp-admin/includes/class-wp-upgrader.phpI’m not entirely sure how you want to run a server command through PHP but I know you can via
exec()orshell_exec()Have you considered automated deployments? There are services out there that will push changed code to your server via FTP instead of you having to worry about git hooks.
I personally use DeployBot because I have my repos pre-hosted on BitBucket, but we use Beanstalk at work daily, which is more of an all-in-one solution.
Forum: Hacks
In reply to: Translation files for JavaScript?@bcworkz – Would you be referring to BackBoneJS which is what manages the media popups and such? I’ve yet to fully understand BackBone but from what I DO understand is it is sort of an MVC framework for JavaScript whereas most of your ‘templating’ you do in HTML and PHP.
Idk if that would fit your scenario David and it’s got a learning curve, but from my perspective, if I have a large JavaScript project BackBone would be the way to go.
If it’s not a huge project localize_script will be the way to go. Some fairly large libraries use it already, it’s just a matter of discipline to put together the array.
Forum: Hacks
In reply to: Adding dynamic list-field to Woocommerce checkoutDebug bar will not debug clicks, for that you need javascript and you can use
window.console.log( $var )orwindow.console.trace( $var )if you need an in-depth trace of the call.Also shameless plug here, but I do believe there are some good snippets you can use: https://webdevstudios.com/2015/10/15/debugging-wordpress-tips-snippets/
That should help you with debugging as well.
Forum: Hacks
In reply to: Custom css recognising border color but not margin-top changeDid a quick look and for one I’m confused 😀 – you have three different stylesheets trying to do operations for one location:
- custom.css
- responsive.css
- style.css
It looks like custom.css is the last one loaded, and is overriding some styles at least for header_left ( I didn’t check all of them ). I have a feeling that fixing any duplicates in that custom.css will fix your issue.
For the future, if you’re looking for ways to consolidate your css, I use a SASS compiler with Grunt, so I literally only have one stylesheet to handle, helps fixing problems like this.
Forum: Hacks
In reply to: Header Under Slider That Sticks On ScrollCheck out Sticky Kit, it’s super straight forward. There are others out there of course, but I just had to use this one in a project and I was blown away at how straight forward it was to get working.