Jay
Forum Replies Created
-
Hey Emre,
Interesting question. I’ve not tested this with any specific caching plugin no. However, if you have any issues I’m always open to pull requests or even a simple discussion.
The plugin uses jQuery cookie to handle cookies. Sometime ago, I did have issues with W3TC using PHP’s set_cookie() methods obviously. If the page is cached it would circumvent that. So, I moved to javascript for cookies ( since the plugin is mainly javascript anyhow ).
The javascript ‘should’ work with page caching, and I’ve had no reports telling me otherwise. I can say that the java script only looks to see if the page should be gated, and if so, it then goes through the logic to determine rather or not to show the dialog, if the user has the cookie or not, etc…
Basically even if a user is using page caching ( which most do ), the ‘only’ thing that’s cached is rather or not the page should be gated. The javascript handles the rest.
You can see the logic I’m talking about here in the source code. https://github.com/JayWood/content-warning-v3/blob/master/js/cwv3.js#L128
But, I’m not perfect ( though I’d like to be ) so if you find any issues please don’t hesitate to let me know or submit a pull request.
Hey Kaaven, thanks for the bug report. I’m aware of this issue with the number field. I’m mid-way through a settings re-write which also handles this.
Forum: Plugins
In reply to: [Agy - Age verification for WooCommerce] Dialog load after pageNot at this time. The dialog is handled via JavaScript and is loaded only after the entire page is loaded.
The load time depends strictly on your page load time. ie. if you have 100+ large images, it may take quite some time to get to the dialog loading point.
Forum: Plugins
In reply to: [Agy - Age verification for WooCommerce] How to protect a single page?Monster,
Can you provide a few more details like so:
- What theme are you using?
- What version of the theme
- What plugin version
Basically this ‘should’ work out of the box, but there can be a couple issues that would prevent it from doing so.
1.) If there’s a javascript fatal error on your page, it may be preventing the rest of the javascript from firing.
2.) If your theme does not have the standard wp_header() or wp_footer() methods in place, then no, this plugin will not work.In the mean time, I’ll also double check to make sure I didn’t miss something myself.
Forum: Hacks
In reply to: Schedule a specific post status to change at regular timesSame idea just won’t have to run a query. You really just need the time logic in place and then use wp_update_post.
Forum: Hacks
In reply to: Schedule a specific post status to change at regular timesYou’re on the right track. I’m on mobile so I can’t provide code examples but it would look like so:
Create an event to fire every 24 hours. 15m if you want precision but you’ll want to short circuit the handler if conditions aren’t met.
Create the handler with this logic ( or a variation ):
If – day of week = mon-fri
And – time between 3pm & 10pm set published for draft posts
Else – set draft for published postsSimilar logic for weekend times. But it could go in the same handler. Depending on the amount of posts you have this can be heavy. But is definitely a quick solution.
To set the status you’ll need a query to pull all draft posts by post status then update those if not empty. Opposite for published posts.
For that look into get_posts or WP_Query.
Forum: Hacks
In reply to: Get post_id from slugs or permanentlinkDon’t forget get_page_by_path():
https://codex.wordpress.org/Function_Reference/get_page_by_pathForum: Hacks
In reply to: Ajax request is not working in latest wordpressYour Ajax is using the current page url. More commonly Ajax should be ran through wp-ajax
See here: https://codex.wordpress.org/AJAX_in_Plugins
Wrote an article some time ago with code examples if you need a visual guide: https://webdevstudios.com/2015/02/12/handling-ajax-in-wordpress/
I’m on mobile right now but if you can post the accompanying php script I can take a look when I’m home.
It would be a bit of a hack but yes you can change that. Right now that’s how the ‘popup’ works. To change it would require a bit of dev skills.
At this time, there is no way to change it easily, but here is the dev documentation for the plugin if it helps at all: https://github.com/JayWood/content-warning-v3/wiki/Dev-Documentation
Forum: Hacks
In reply to: create object inside __construct then call it in another method of same class?This is because it’s being handled incorrectly. When you use a string as the first parameter in the array, it assumes static.
register_activation_hook() is ran through _wp_filter_build_unique_id() which makes the determination of rather to use it as static or not. Look at line 945, that’s what is producing your error.
To fix this, you need to modify your code.
<?php if ( class_exists('MyPlugin') ) { $MyPlugin = new MyPlugin(); register_activation_hook( __FILE__, array( $MyPlugin, 'activate') ); register_deactivation_hook( __FILE__, array( $MyPlugin, 'deactivate') ); // Not sure why you have multiple new instances? $plugin = new MyPlugin(); }When using hooks you must use an array for the second variable if you’re trying to use a method within an object ( class ). I’m sure there’s a way around it, but this is how it’s been for ages.
Forum: Hacks
In reply to: Modify how a PDF file from the media library is displayedGot just the filter for this: media_send_to_editor()
It controls the HTML that’s sent to the editor with a few extra bits of data.
Forum: Hacks
In reply to: Redirect "wlwmanifest.xml" to homepageYou are correct. The XML file is not a template, is not a page, and surely isn’t a post. Therefore it completely bypasses WordPress.
That seems about right for the redirect. I’m sure there’s a “WordPress Way” of editing the .htaccess file since Core does this already, but that’s not something I typically do.
It’s just one line, but if you want to do this across multiple sites etc, then I could understand the necessity of wanting an automated solution.
Here’s a great how-to on editing .htaccess via PHP – http://forums.devshed.com/php-development/552406-editing-htaccess-php-post2106528.html
Forum: Hacks
In reply to: Redirect "wlwmanifest.xml" to homepageThat’s a direct request, and therefore ignores WordPress. What you want is at the server level. I’m on my phone right now or I’d show you.
Google this “htaccess redirect file to url” and you’ll find what you’re looking for.
Forum: Plugins
In reply to: [Agy - Age verification for WooCommerce] Video Magazine ThemeMarking resolved due to no response in months.
You should just be able to drop this in, and replace the img tag with your image.
<div style="text-align: center;"><img src="http://img.com/img.jpg" /></div>If this doesn’t work, share your code for the content area.