The problem came from the jQuery(document).ready
!
Many thanks. ๐
I have 2 time pickers, is this a problem?
Here is my full code, I don’t understand too:
jQuery(document).ready(function($) {
var acfVersion = acf.get('acf_version');
console.log(acfVersion);
/*
acf.addAction('time_picker_init', function( $input, args, field ) {
console.log($input);
console.log(args);
console.log(field);
});
*/
acf.add_filter('time_picker_args', function( args, field ){
console.log(args);
console.log(field);
return args;
});
});
I don’t have any feedback in my console either:
acf.add_filter('time_picker_args', function( args, field ){
console.log(args);
return args;
});
Unfortunately, set $deps
doesn’t change anything. ๐
Like this:
function my_acf_admin_enqueue_scripts() {
wp_enqueue_script( 'acf-datetime', get_stylesheet_directory_uri() . '/js/acf-datetime.js', false, '1.0.0' );
}
add_action('acf/input/admin_enqueue_scripts', 'my_acf_admin_enqueue_scripts');
There is something that I don’t understand.
In my function.php
I added the action:
acf/input/admin_enqueue_scripts
And then in my JS script:
jQuery(document).ready(function($) {
var acfVersion = acf.get('acf_version');
console.log(acfVersion);
acf.addAction('time_picker_init', function( $input, args, field ) {
console.log($input);
console.log(args);
console.log(field);
});
});
Nothing is happening except the version of ACF (which is used just for testing).
Do you know why ?
Perfect, this is the information I was missing!
I’ll watch this, thank you!
Thank you for your feedback, I will look at these resources.
I come to give the solution for people who have the same problem.
I was coming to overwrite the arguments instead of adding them to the array.
It is necessary to do as follows:
$args['my_parameter'] = 'my_value';
The functionality is native now.
Thanks!
I had not seen the little subtlety!
It works! Thank you very much!
I put the code for people who would have the same problem:
'meta_query' => array(
'relation' => 'AND',
'date_clause' => array(
'key' => 'event_date',
'compare' => '=',
),
'time_clause' => array(
'key' => 'event_time',
'compare' => '=',
),
),
'orderby' => array(
'date_clause' => 'ASC',
'time_clause' => 'ASC',
),
The time is stored in H:i:s
format (for example: 16:30:00).
Unfortunately this doesn’t work:
$q = new WP_Query( array(
'orderby' => array(
'event_date' => 'ASC',
'event_time' => 'ASC',
),
) );
The dates are mixed (and the times too).
I’m not sure the code does what I want.
I would like my events to be displayed in order of date and time, but knowing that I have my 2 fields which are separate. So my timestamp is distorted.
(I made a wrong click on the Mark as resolved)
You mean rather the 10th?
โorderbyโ with multiple โmeta_keyโs?
An imperative feature!
+1
Hi @James,
I don’t understand, this ticket is already in the category “Feature Requests”. ๐ฎ
Ok, thanks, but it’s not possible to do it for an upcoming update ? (nothing urgent)
Hi @James,
Thank you for your reply but why is this not possible?
It is not possible to add a confirmation box ? ๐ฎ
@sixoclockish Thanks a lot !!! ๐
So if I do not have a displayed error, I can use this solution? ๐
Hi John,
Here is my application:
<?php $files = get_field('files');
foreach( $files as $file ): ?>
<li>
<a href="<?php echo $file['url']; ?>">
<?php echo $file['title']; ?>
</a>
</li>
<?php endforeach; ?>
It works (see attachments), but I don’t know if it will eventually produce errors afterwards.
Hi everyone,
I’d like to go a little further (and more complicated):
Is it possible to count the number of row with a true/false field on “true”.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.