Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterThat works but it affects your performance as the action "check-update" runs on every request to your website. This triggers the query to the database. Running only on your settings page reduces the load. But that also means the value is updated only when users visit the settings page, so it's kind of manual reset.
Anh Tran
KeymasterAh, I got it. I will check that ๐
Thanks for your suggestion!
Anh Tran
KeymasterHere it is:
function hello() { return '<b style="color:red;">Hello</b>'; }Anh Tran
KeymasterHi,
How do you get the
$post_idand how do you use the code above inside your code to register meta boxes?Anh Tran
KeymasterI got it. In this case, the problem is handling the "saved meta value". I'd suggest using WP cron to perform a regular check on the meta value (posts). When a condition occurs (date is passed), then update the meta value.
This is the pseudo code:
register_activation_hook(__FILE__, 'prefix_activation'); function prefix_activation() { if (! wp_next_scheduled ( 'prefix_daily_check' )) { wp_schedule_event(time(), 'hourly', 'prefix_daily_check'); } } add_action('prefix_daily_check', 'prefix_update_posts_daily'); function prefix_update_posts_daily() { $now = time(); $option = get_option( 'featured_position_1' ); foreach ( $option as $key => $value ) { if ( $time > strtotime( $value['featured_item_1_schedule_start'] ) ) { unset( $option[$key] ); } } update_option( 'featured_position_1', $option ); }Anh Tran
KeymasterHi Locke2,
I'm not very clear about your question. Do you want a checkbox that when it's checked, the post will be set to "sticky"?
Anh Tran
KeymasterHi,
If an user selects:
- Post A from Feb 6 to Feb 10
- Post B from Feb 8 to Feb 12Then after Feb 6, the post A is removed from the selection (in the admin area)? Is that what you want?
Anh Tran
KeymasterJust looked at the code again and found that you "echo" the content instead of returning it. The callback function "must" return the content.
If your content is complicated, you should use output buffering to return it.
Anh Tran
KeymasterDo you mean using it for the ajax request for select_advanced field as you talked in another topic?
Anh Tran
KeymasterHi Jackky, let me check and fix that. Thanks for reporting!
Anh Tran
KeymasterHi Jackky,
Thanks for the idea. It's a good idea. We haven't implemented that feature yet in the plugin. I'll try that ๐
Anh Tran
KeymasterHi,
I think you can do that by looping through the meta box definition and remove the fields when a condition happens. The idea is similar to this documentation. Please try it.
Anh Tran
KeymasterHi,
Unfortunately, there's no ways to setup 4 columns at the moment. The settings extension uses the WordPress layouts, which supports only 1 and 2 columns.
February 3, 2017 at 11:24 PM in reply to: Date / Datetime field with clone and timestamp wont work #4953Anh Tran
KeymasterHi,
I've just found that bug and fixed it on Github. Please try the development version on Github. The new version of the plugin will be released soon.
Thanks.
February 2, 2017 at 8:45 PM in reply to: How to display a custom file upload error in a plupload_image field? #4947Anh Tran
KeymasterHi, continuing from the previous topic, we've just updated the plugin on Github with a new parameter
max_file_sizethat limit the file size for file/image upload fields.Please try it and let me know what you think.
-
AuthorPosts