
The ACF Date Picker field actually uses the jQuery UI Datepicker. By default, its year range is from 1925 up to the current year.
You can write custom JS to override the yearRange option:
add_action('acf/input/admin_footer', function() {
?>
<script type="text/javascript">
(function($) {
if (typeof acf !== 'undefined') {
acf.add_action('ready_field/type=date_picker', function($field){
$field.find('input.input').datepicker('option', {
yearRange: '1800:c', // 1800 from a specific year up to the current year.
changeMonth: true,
changeYear: true
});
});
}
})(jQuery);
</script>
<?php
});
This way, you can easily select years like 1800 or even earlier.

Share your code of CPT

<?php
// Get the raw field value (ACF date field usually stored as Ymd, e.g. 19901231)
$date_string = get_field( 'person-birthday', $post->ID );
if( $date_string ) {
// Convert to DateTime object
$birthday = DateTime::createFromFormat( 'Ymd', $date_string );
if( $birthday ) {
// Calculate age
$interval = $birthday->diff( new DateTime() );
// Display formatted date + age
echo $birthday->format('d M Y') . ' (' . $interval->y . ' ans)';
}
}
?>

Could you please confirm that I have the correct code for adding a custom field to this code?


My problem is that I am using a Post Category but the group still appears on pages.

I found the answer (https://support.advancedcustomfields.com/forums/topic/location-rule-is-not-working/#post-152686), and it seems to work, but I want to use the uncategorized category. Would you please tell me how I can utilize this category?

These Job Field Groups shouldn’t appear on the page, I want them to disappear.

I am also facing this issue.

In my screenshot, you can see that I have a lot of multiple values.
https://ibb.co/zNdZvPX

Never mind, I have deleted the custom taxonomy template and am not using it anymore. Thanks

I noticed that the custom Taxonomy Template does not display any of the fields.

To display these posts, I am using the Custom TaxonomyTemplate.

Also, saving the post again and got this https://prnt.sc/20i0okp

Okay, I figured it out. It was a theme issue.

I added this and it’s working fine. Is this way right or wrong?
add_filter('acf/format_value', 'acf_ul_class');

I have added your line but now its not showing the text, which i have mentioned. and i am using this format of last_date field M d, Y

No actually my code works like this.
I have posted a job and given a last date, which is 10 Jan 2020, so when 10 Jan 2020 comes, it will show job Expired but actually I don’t want to show that text on that date, it will show on 11 Jan 2020.

You can change this in to the field https://prnt.sc/udiub6 and for the date formatting you need to see this https://wordpress.org/support/article/formatting-date-and-time/

I am still not sure, may be this will work for you. You have to add your fields in first line and you have to multiple times for multiple checkboxes.
<?php $values = get_field('MYFIELD', $post->post_parent); if(in_array("CHECKBOX_NAME", $values )){ ?>
<?php get_template_part("template-parts/button-template-loop/button-patch-loop"); ?>
<? } ?>

You can use limit of numbers here https://prnt.sc/udim6k
Its in the ACF plugin, you don’t need to add another validation.

@John Huebner, did you got it?

Want to Trim the checkbox fields, let say I checked 4 options and want to display 2 options and other options would be displayed in the tool tip.
I use your code which you gave me and it’s not trimming the checkboxes.

Hello, @john I test it and it’s not working, help me, please.

Hello,
Thank you for your help but this is not working, it’s showing me all checkboxes.
Regards
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.